Ignore:
Timestamp:
2012-07-17T09:27:25+12:00 (12 years ago)
Author:
sjm84
Message:

Reformatting this file and removing two debug statements

File:
1 edited

Legend:

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

    r25816 r25953  
    7474            provide_annotations = true;
    7575        }
    76         return true;    }
     76        return true;
     77    }
    7778
    7879    public Node process(Node message_node)
     
    121122        if (document_type != null && document_type.equals(""))
    122123        {
    123           //document_type = "hierarchy";
    124           document_type = null; // we'll get it later if not already specified
     124            //document_type = "hierarchy";
     125            document_type = null; // we'll get it later if not already specified
    125126        }
    126127        //whether to retrieve siblings or not
     
    191192        }
    192193
    193         if (document_type == null) {
    194           logger.error("getting document type");
    195           document_type = getDocumentType(basic_doc_list, collection, userContext, page_response);
    196           logger.error("new doc type = "+document_type);
    197         }
    198         if (document_type != null) {
    199           // set the doctype from the cgi arg or from the server as an attribute
    200           the_document.setAttribute(GSXML.DOC_TYPE_ATT, document_type);
    201         }
    202         else {
    203           logger.error("doctype is null!!!***********");
    204     }
     194        if (document_type == null)
     195        {
     196            logger.error("getting document type");
     197            document_type = getDocumentType(basic_doc_list, collection, userContext, page_response);
     198            logger.error("new doc type = " + document_type);
     199        }
     200        if (document_type != null)
     201        {
     202            // set the doctype from the cgi arg or from the server as an attribute
     203            the_document.setAttribute(GSXML.DOC_TYPE_ATT, document_type);
     204        }
     205        else
     206        {
     207            logger.error("doctype is null!!!***********");
     208        }
    205209
    206210        // Create a parameter list to specify the required structure information
     
    492496
    493497        Element dc_response_doc_list = (Element) GSXML.getNodeByPath(dc_response_message, path);
    494        
     498
    495499        if (expand_document)
    496500        {
     
    517521            Element dc_response_doc_content = (Element) GSXML.getChildByTagName(dc_response_doc, GSXML.NODE_CONTENT_ELEM);
    518522            //Element dc_response_doc_external = (Element) GSXML.getChildByTagName(dc_response_doc, "external");
    519            
     523
    520524            if (dc_response_doc_content == null)
    521525            {
     
    720724    }
    721725
    722   protected String getDocumentType(Element basic_doc_list, String collection, UserContext userContext, Element page_response)
    723   {
    724    
    725     Element ds_message = this.doc.createElement(GSXML.MESSAGE_ELEM);
    726     String to = GSPath.appendLink(collection, "DocumentStructureRetrieve");// Hard-wired?
    727     Element ds_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext);
    728     ds_message.appendChild(ds_request);
    729 
    730     // Create a parameter list to specify the required structure information
    731     Element ds_param_list = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
    732     Element ds_param = this.doc.createElement(GSXML.PARAM_ELEM);
    733     ds_param_list.appendChild(ds_param);
    734     ds_param.setAttribute(GSXML.NAME_ATT, "info");
    735     ds_param.setAttribute(GSXML.VALUE_ATT, "documentType");
    736    
    737     ds_request.appendChild(ds_param_list);
    738    
    739     // add the node list we created earlier
    740     ds_request.appendChild(basic_doc_list);
    741    
    742     logger.error("doctype request = "+this.converter.getPrettyString(ds_request));
    743     // Process the document structure retrieve message
    744     Element ds_response_message = (Element) this.mr.process(ds_message);
    745     logger.error("doctype response = "+this.converter.getPrettyString(ds_response_message));
    746     if (processErrorElements(ds_response_message, page_response))
    747       {
    748     return null;
    749       }
    750 
    751     String[] links = { GSXML.RESPONSE_ELEM, GSXML.DOC_NODE_ELEM + GSXML.LIST_MODIFIER, GSXML.DOC_NODE_ELEM, "nodeStructureInfo"};
    752     String path = GSPath.createPath(links);
    753     Element info_elem = (Element) GSXML.getNodeByPath(ds_response_message, path);
    754       Element doctype_elem = GSXML.getNamedElement(info_elem, "info", "name", "documentType");
    755     if (doctype_elem != null) {
    756       String doc_type = doctype_elem.getAttribute("value");
    757       return doc_type;
    758     }
    759     return null;
    760   }
     726    protected String getDocumentType(Element basic_doc_list, String collection, UserContext userContext, Element page_response)
     727    {
     728        Element ds_message = this.doc.createElement(GSXML.MESSAGE_ELEM);
     729        String to = GSPath.appendLink(collection, "DocumentStructureRetrieve");// Hard-wired?
     730        Element ds_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext);
     731        ds_message.appendChild(ds_request);
     732
     733        // Create a parameter list to specify the required structure information
     734        Element ds_param_list = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
     735        Element ds_param = this.doc.createElement(GSXML.PARAM_ELEM);
     736        ds_param_list.appendChild(ds_param);
     737        ds_param.setAttribute(GSXML.NAME_ATT, "info");
     738        ds_param.setAttribute(GSXML.VALUE_ATT, "documentType");
     739
     740        ds_request.appendChild(ds_param_list);
     741
     742        // add the node list we created earlier
     743        ds_request.appendChild(basic_doc_list);
     744
     745        // Process the document structure retrieve message
     746        Element ds_response_message = (Element) this.mr.process(ds_message);
     747        if (processErrorElements(ds_response_message, page_response))
     748        {
     749            return null;
     750        }
     751
     752        String[] links = { GSXML.RESPONSE_ELEM, GSXML.DOC_NODE_ELEM + GSXML.LIST_MODIFIER, GSXML.DOC_NODE_ELEM, "nodeStructureInfo" };
     753        String path = GSPath.createPath(links);
     754        Element info_elem = (Element) GSXML.getNodeByPath(ds_response_message, path);
     755        Element doctype_elem = GSXML.getNamedElement(info_elem, "info", "name", "documentType");
     756        if (doctype_elem != null)
     757        {
     758            String doc_type = doctype_elem.getAttribute("value");
     759            return doc_type;
     760        }
     761        return null;
     762    }
    761763
    762764    /**
Note: See TracChangeset for help on using the changeset viewer.