Changeset 34235 for main/trunk


Ignore:
Timestamp:
2020-07-01T11:27:47+12:00 (4 years ago)
Author:
ak19
Message:

Added functionality for client-GLI to upload an edited metadata set back to the remote GS3 server. When a user has edited an existing metadata set, GLI would work. For example, new fields in the set appear in the EnrichPane for the collections using the metadata set including when GLI is restarted. Except they didn't work in the remote GS3 case, because an edited mds file wasn't being uploaded back to the remote GS3. This commit contains the changes that take care of reuploading after mds edits when GS is remote. This method is mostly a copy of importMetadataSet() above, except no need to handle the hidden.mds file as that should not even have been made available for editing in GLI. Nor any need for MetadataSetManager.loadMetadataSet(File) as that was already done by the caller, MetadataSetDialog.EditButtonListener.actionPerformed().

Location:
main/trunk/gli/src/org/greenstone/gatherer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java

    r34205 r34235  
    12941294    }
    12951295    }
    1296 
     1296   
     1297    /**
     1298     * In the case of a remote GS, this method takes care of reuploading a modified mds file after its
     1299     * Metadata Set has been edited.
     1300     * This method is mostly a copy of importMetadataSet() above, except no need to handle the hidden.mds
     1301     * file as that should not even have been made available for editing in GLI.
     1302     * Nor any need for MetadataSetManager.loadMetadataSet(File) as that was already done by the caller,
     1303     * MetadataSetDialog.EditButtonListener.actionPerformed().
     1304     */
     1305    public void updateMetadataSet(MetadataSet external_metadata_set) {
     1306    try {
     1307        File external_metadata_set_file = external_metadata_set.getMetadataSetFile();
     1308        File metadata_set_file = new File(getLoadedCollectionMetadataDirectoryPath(), external_metadata_set_file.getName());
     1309        // If we're using a remote Greenstone server, upload the metadata file
     1310        if (Gatherer.isGsdlRemote) {
     1311            Gatherer.remoteGreenstoneServer.uploadCollectionFile(collection.getGroupQualifiedName(false), metadata_set_file);
     1312        }
     1313        }
     1314        catch (Exception exception) {
     1315        DebugStream.printStackTrace(exception);
     1316        }   
     1317    }
     1318   
    12971319
    12981320    /** Determine if we are currently in the middle of importing (and thus, in this case, we can't allow the log writer to exit). Boy was this a mission to track down. The cascade of crap rolls out something like this: Joe Schmo clicks 'Build Collection', which calls the importCollection() method above, which in turn saves the collection with a saveTask, which fires a collectionChanged message once its finished, which drives the list of logs shown on the create pane to update, which fires a itemChanged() event to the OptionsPane who dutifully tells the current log writer thread to finish up writing (all zero lines its been asked to write) and then die. Wereapon Joe Schmo gets a pretty log to look at, but it isn't actually being written to file so the next time he tries to view it faeces hits the air motion cooling device. Joy.
  • main/trunk/gli/src/org/greenstone/gatherer/gui/MetadataSetDialog.java

    r34233 r34235  
    152152        MetadataSet edited_metadata_set = (MetadataSet) current_set_list.getSelectedValue();
    153153        MetadataSetManager.unloadMetadataSet(edited_metadata_set);
     154        // If we can make that assumption for a local GLI, then we can make it for a client-GLI too:
     155        // assume mds file was edited and reupload to the remote server
     156        Gatherer.c_man.updateMetadataSet(edited_metadata_set); // takes care of remote case
    154157        MetadataSetManager.loadMetadataSet(edited_metadata_set.getMetadataSetFile());
    155158        sets_changed = true;
Note: See TracChangeset for help on using the changeset viewer.