Ignore:
Timestamp:
2012-01-26T11:50:17+13:00 (12 years ago)
Author:
sjm84
Message:

Adding UserContext to replace the use of lang and uid

File:
1 edited

Legend:

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

    r24979 r24993  
    2121import org.greenstone.gsdl3.util.GSXML;
    2222import org.greenstone.gsdl3.util.GSPath;
     23import org.greenstone.gsdl3.util.UserContext;
    2324
    2425import org.w3c.dom.Element;
     
    147148        result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS);
    148149
    149         String lang = request.getAttribute(GSXML.LANG_ATT);
     150        UserContext userContext = new UserContext(request);
     151       
    150152        // Get the parameters of the request
    151153        Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
     
    182184        }
    183185        // send the query to all colls
    184         Element query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to_att.toString(), lang, "");
     186        Element query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to_att.toString(), userContext);
    185187        query_message.appendChild(query_request);
    186188        // should we add params individually?
     
    257259    protected boolean initCollectionList()
    258260    {
    259         String lang = "en";
    260         String uid = "";
     261        UserContext userContext = new UserContext();
     262        userContext.setLanguage("en");
     263        userContext.setUserID("");
     264
    261265        // first, get the message router info
    262266        Element coll_list_message = this.doc.createElement(GSXML.MESSAGE_ELEM);
    263         Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", lang, ""); // uid
     267        Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", userContext); // uid
    264268        coll_list_message.appendChild(coll_list_request);
    265269        logger.debug("coll list request = " + this.converter.getPrettyString(coll_list_request));
     
    281285            Element c = (Element) colls.item(i);
    282286            String name = c.getAttribute(GSXML.NAME_ATT);
    283             Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, name, lang, uid);
     287            Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, name, userContext);
    284288            metadata_message.appendChild(metadata_request);
    285289        }
     
    331335        result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS);
    332336
    333         String lang = request.getAttribute(GSXML.LANG_ATT);
     337        UserContext userContext = new UserContext(request);
    334338        // Get the parameters of the request
    335339        Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
     
    382386            String cname = (String) e.getKey();
    383387            Element doc_nodes = (Element) e.getValue();
    384             Element meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(cname, DOCUMENT_METADATA_RETRIEVE_SERVICE), lang, "");
     388            Element meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(cname, DOCUMENT_METADATA_RETRIEVE_SERVICE), userContext);
    385389            meta_request.appendChild(doc_nodes);
    386390            meta_request.appendChild(new_param_list.cloneNode(true));
Note: See TracChangeset for help on using the changeset viewer.