Ignore:
Timestamp:
2003-07-18T16:01:10+12:00 (21 years ago)
Author:
kjdon
Message:

service params are now namespaced to avoid conflict with same named action params, docActionalso adds some params to the receptionists GSParams object, and fixed up the enriching stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/action/DocumentAction.java

    r4875 r4982  
    4444    public static final String DOC_TYPE_ARG = "dt";
    4545    public static final String GOTO_PAGE_ARG = "gp";
     46    public static final String ENRICH_DOC_ARG = "ed";
    4647   
    4748    /** if this is set to true, when a document is displayed, any annotation
     
    295296    }
    296297    if (provide_annotations) {
    297         // now we can modifiy the response doc if needed
    298         String enrich_service = (String)params.get(GSCGI.SERVICE_ARG);
    299         if (enrich_service != null && !enrich_service.equals("")) {
     298        String service_selected = (String)params.get(ENRICH_DOC_ARG);
     299        if (service_selected != null && service_selected.equals("1")) {
     300        // now we can modifiy the response doc if needed
     301        String enrich_service = (String)params.get(GSCGI.SERVICE_ARG);
     302        System.out.println("enrich service is "+enrich_service);
    300303        // send a message to the service
    301304        Element enrich_message = doc_.createElement(GSXML.MESSAGE_ELEM);
    302305        Element enrich_request = GSXML.createBasicRequest(doc_, GSXML.REQUEST_TYPE_PROCESS, enrich_service, lang);
    303306        enrich_message.appendChild(enrich_request);
    304         Element enrich_pl = getServiceParamList(cgi_paramList);
    305         enrich_request.appendChild(enrich_pl);
     307        // check for parameters
     308        HashMap service_params = (HashMap)params.get("s1");
     309        if (service_params != null) {
     310            Element enrich_pl = GSXML.createParameterList(doc_, service_params);
     311            enrich_request.appendChild(enrich_pl);
     312        }
    306313        Element e_doc_list = doc_.createElement(GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER);
    307314        enrich_request.appendChild(e_doc_list);
     
    355362    }
    356363
    357     protected Element getServiceParamList(Element cgi_param_list) {
    358 
    359     Element new_param_list = doc_.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
    360     Element param;
    361     NodeList cgi_params = cgi_param_list.getChildNodes();
    362     for (int i=0; i<cgi_params.getLength(); i++) {
    363         Element p = (Element) cgi_params.item(i);
    364         String name = p.getAttribute(GSXML.NAME_ATT);
    365         if (name.equals(GSCGI.SERVICE_ARG) || name.equals(GSCGI.REQUEST_TYPE_ARG) || name.equals(GSCGI.CLUSTER_ARG) || name.equals(GSCGI.DOCUMENT_ARG) || name.equals(SIBLING_ARG) ) {
    366         continue;
    367         }
    368         // esle add it in to the list
    369         new_param_list.appendChild(doc_.importNode(p, true));
    370     }
    371     return new_param_list;
     364    /** tell the param class what its arguments are
     365     * if an action has its own arguments, this should add them to the params
     366     * object - particularly important for args that should not be saved */
     367    public boolean getActionParameters(GSParams params) {
     368    params.addParameter(DOC_TYPE_ARG, true);
     369    params.addParameter(GOTO_PAGE_ARG, false);
     370    params.addParameter(ENRICH_DOC_ARG, false);
     371    return true;
    372372    }
     373
    373374
    374375    /** this method gets the collection description, the format info, the
Note: See TracChangeset for help on using the changeset viewer.