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/action/NoCollQueryAction.java

    r24988 r24993  
    6565
    6666        String request_type = (String) params.get(GSParams.REQUEST_TYPE);
    67         String lang = request.getAttribute(GSXML.LANG_ATT);
    68         String uid = request.getAttribute(GSXML.USER_ID_ATT);
     67        UserContext userContext = new UserContext(request);
    6968        if (request_type.equals("d"))
    7069        {
     
    7271            // the only info we need to return is the collection list cos the xslt does teh rest
    7372
    74             Element coll_list = getCollectionList(lang, uid);
     73            Element coll_list = getCollectionList(userContext);
    7574            page_response.appendChild(this.doc.importNode(coll_list, true));
    7675            return page_response;
     
    8988        {
    9089            logger.error("no collections were specified!");
    91             Element coll_list = getCollectionList(lang, uid);
     90            Element coll_list = getCollectionList(userContext);
    9291            page_response.appendChild(this.doc.importNode(coll_list, true));
    9392            return page_response;
     
    111110        {
    112111            String to = GSPath.appendLink(colls[i], service_name);
    113             Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);
     112            Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext);
    114113            mr_query_message.appendChild(mr_query_request);
    115114            mr_query_request.appendChild(query_param_list.cloneNode(true));
     
    130129                String coll_name = extractCollName(((Element) responses.item(j)).getAttribute(GSXML.FROM_ATT));
    131130                String path = GSPath.appendLink(coll_name, "DocumentMetadataRetrieve");
    132                 Element mr_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, path, lang, uid);
     131                Element mr_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, path, userContext);
    133132                mr_meta_message.appendChild(mr_meta_request);
    134133                mr_meta_request.appendChild(this.doc.importNode(document_list, true));
     
    182181    }
    183182
    184     protected Element getCollectionList(String lang, String uid)
     183    protected Element getCollectionList(UserContext userContext)
    185184    {
    186185
    187186        // first, get the message router info
    188187        Element coll_list_message = this.doc.createElement(GSXML.MESSAGE_ELEM);
    189         Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", lang, uid);
     188        Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", userContext);
    190189        coll_list_message.appendChild(coll_list_request);
    191190        Element coll_list_response = (Element) this.mr.process(coll_list_message);
     
    209208            String name = c.getAttribute(GSXML.NAME_ATT);
    210209
    211             Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, name, lang, uid);
     210            Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, name, userContext);
    212211            metadata_request.appendChild(coll_param_list.cloneNode(true));
    213212            metadata_message.appendChild(metadata_request);
Note: See TracChangeset for help on using the changeset viewer.