Ignore:
Timestamp:
2016-07-22T19:41:17+12:00 (8 years ago)
Author:
ak19
Message:

Bugfix to oversight: web document editor didn't reindex on removing metadata, only on setting it. This is because there wasn't corresponding Service on Java side to handle removing metadata. Now the Java code has a ModifyMetdata service and this is connected to both the set- and remove-metadata functions in the javascript. For now, the javascript metadataserver calls have been made synchronous by setting the async ajax-jquery property to false. Need to test whether the code still works asynchronous as before.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java

    r30616 r30617  
    6767    private static final String DELETE_SERVICE = "DeleteCollection";
    6868    private static final String RELOAD_SERVICE = "ReloadCollection";
    69     private static final String SET_METADATA_SERVICE = "SetMetadata";
     69    private static final String MODIFY_METADATA_SERVICE = "ModifyMetadata"; // set or remove metadata
     70
    7071
    7172    // params used
     
    128129                param_list.appendChild(param);
    129130            }
    130             else if (service.equals(ACTIVATE_SERVICE) || service.equals(IMPORT_SERVICE) || service.equals(BUILD_SERVICE) || service.equals(RELOAD_SERVICE) || service.equals(DELETE_SERVICE) || service.equals(SET_METADATA_SERVICE))
     131            else if (service.equals(ACTIVATE_SERVICE) || service.equals(IMPORT_SERVICE) || service.equals(BUILD_SERVICE) || service.equals(RELOAD_SERVICE) || service.equals(DELETE_SERVICE) || service.equals(MODIFY_METADATA_SERVICE))
    131132            {
    132133
     
    185186    {
    186187        // check permissions
    187         if (!userHasCollectionEditPermissions(request)) {
     188        if (!userHasCollectionEditPermissions(request)) {
    188189            Document result_doc = XMLConverter.newDOM();
    189190            Element result = GSXML.createBasicResponse(result_doc, "processBuildAndActivateCollection");
    190191            GSXML.addError(result, "This user does not have the required permissions to perform this action.");
    191192            return result;
    192         }
    193 
     193        }
     194
     195           
    194196        waitUntilReady(request);
    195197        Element buildResponse = processBuildCollection(request);
     
    305307    }
    306308
    307     protected Element processSetMetadata(Element request)
     309    protected Element processModifyMetadata(Element request)
    308310    {
    309311        if (!userHasCollectionEditPermissions(request)) {
    310312        Document result_doc = XMLConverter.newDOM();
    311         Element result = GSXML.createBasicResponse(result_doc, "processSetMetadata");
     313        Element result = GSXML.createBasicResponse(result_doc, "processModifyMetadata");
    312314        GSXML.addError(result, "This user does not have the required permissions to perform this action.");
    313315        return result;
    314316        }
    315317
    316         return runCommand(request, GS2PerlConstructor.SET_METADATA_SERVER);
     318        return runCommand(request, GS2PerlConstructor.MODIFY_METADATA_SERVER);
    317319    }
    318320
     
    619621        e = this.desc_doc.createElement(GSXML.SERVICE_ELEM);
    620622        e.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_PROCESS);
    621         e.setAttribute(GSXML.NAME_ATT, SET_METADATA_SERVICE);
     623        e.setAttribute(GSXML.NAME_ATT, MODIFY_METADATA_SERVICE);
    622624        this.short_service_info.appendChild(e);
    623625
     
    708710            constructor.setManifestFile(this.site_home + File.separator + "collect" + File.separator + params.get(COL_PARAM) + File.separator + "manifests" + File.separator + "tempManifest.xml");
    709711        }
    710         else if (type == GS2PerlConstructor.SET_METADATA_SERVER) {
     712        else if (type == GS2PerlConstructor.MODIFY_METADATA_SERVER) {
    711713            StringBuffer querystring = new StringBuffer();
    712714           
     
    977979        if (!coll_db.openDatabase(coll_db_file, SimpleCollectionDatabase.READ))
    978980        {
    979             logger.error("Could not open collection archives database. Database doesn't exist or else somebody is already using it?");
     981            logger.error("Could not open collection archives database. Database doesn't exist or else somebody's already using it?");
    980982            return;
    981983        }
     
    988990        {
    989991            logger.error("Could not open collection archives database. Somebody already using this database!");
     992            return;
    990993        }
    991994        coll_db.setValue(oid, new_value);
Note: See TracChangeset for help on using the changeset viewer.