Changeset 26309


Ignore:
Timestamp:
2012-10-11T19:10:46+13:00 (12 years ago)
Author:
ak19
Message:
  1. Corrections to XML returned by FedoraGS3 to get the VList display for classifierBrowse to work correctly in Greenstone: classifierStyle attribute needs to be set on documents returned. Also added in further missing attributes for query and browse, in case these turn out to be important. 2. Replaced 3-line setAttributeNode() calls with 1-line setAttribute() calls.
Location:
other-projects/gs3-webservices-java-client/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraGS3Connection.java

    r26286 r26309  
    493493            ex = this.getEX(id);
    494494        }
    495         else { // docID refers to a document
     495        else { // docID refers to a document
     496
     497            docNode.setAttribute(GSXML.DOC_TYPE_ATT, "hierarchy");         
     498            docNode.setAttribute(GSXML.NODE_RANK_ATT, "NaN");
     499
    496500            // work out the document's fedora PID and section ID, and then
    497501            // obtain the EX (extracted metadata) and DC datastreams for the doc
     
    509513                dc = this.getDC(docPID);
    510514                dls = this.getDLS(docPID);
     515                docNode.setAttribute(GSXML.NODE_TYPE_ATT, "root");
    511516            }
    512517            else {
    513518                ex = getSectionEXMetadata(docPID, sectionID);
    514519                dc = getSectionDCMetadata(docPID, sectionID);
     520                docNode.setAttribute(GSXML.NODE_TYPE_ATT, "leaf");
    515521            }
    516522        }
     
    17961802
    17971803        Element responseMsg = createResponseMessage(doc, classifierNodeList, ex,
    1798                     GSXML.REQUEST_TYPE_DESCRIBE, /*collectionName+/ */"ClassifierBrowse");
     1804                    GSXML.REQUEST_TYPE_PROCESS, /*collectionName+/ */"ClassifierBrowse");
    17991805        try {
    18001806        return FedoraCommons.elementToString(responseMsg);
     
    18401846    attribute.setValue(classifierID);
    18411847    classNode.setAttributeNode(attribute);
    1842     Attr typeAttribute = doc.createAttribute(GSXML.CHILD_TYPE_ATT);
    1843     typeAttribute.setValue(GSXML.VLIST);
    1844     classNode.setAttributeNode(typeAttribute);
    18451848
    18461849    if(firstLevel == -1) { // CL1 - toplevel node     
     
    18491852        classifierNodeList.appendChild(classNode);
    18501853        classNode.appendChild(nodeStructure);
    1851        
    18521854        nodeStructure.appendChild(root);
     1855        root.setAttribute(GSXML.CHILD_TYPE_ATT, GSXML.VLIST);
     1856
    18531857        if(structure.indexOf("descendants") != -1) {
    18541858        getTitlesByLetterStructure(collectionName, root, classifierID, true, null);
     
    18681872        attribute.setValue(toplevelID);
    18691873        toplevelNode.setAttributeNode(attribute);
    1870         typeAttribute = doc.createAttribute(GSXML.CHILD_TYPE_ATT);
    1871         typeAttribute.setValue(GSXML.VLIST);
    1872         toplevelNode.setAttributeNode(typeAttribute);
    18731874        Element node = (Element)toplevelNode.cloneNode(true); // clone nodes before appending children
    18741875
     
    18761877        toplevelNode.appendChild(nodeStructure);       
    18771878        nodeStructure.appendChild(node);
     1879        node.setAttribute(GSXML.CHILD_TYPE_ATT, GSXML.VLIST);
    18781880
    18791881        if(structure.indexOf("siblings") != -1) { // get the children of the parents too
     
    18841886        } else {
    18851887            node.appendChild(classNode);
     1888            classNode.setAttribute(GSXML.CHILD_TYPE_ATT, GSXML.VLIST);
    18861889        }
    18871890        } else {
     
    18891892        classifierNodeList.appendChild(node);
    18901893        node.appendChild(nodeStructure);
    1891         nodeStructure.appendChild(classNode);
     1894        nodeStructure.appendChild(classNode);   
     1895        classNode.setAttribute(GSXML.CHILD_TYPE_ATT, GSXML.VLIST);
    18921896        }
    18931897       
     
    20012005            // <classifierNode childType="VList" nodeID="CL1.x">
    20022006            subClassifier = doc.createElement(GSXML.CLASS_NODE_ELEM);
    2003             Attr typeAttribute = doc.createAttribute(GSXML.CHILD_TYPE_ATT);
    2004             typeAttribute.setValue(GSXML.VLIST);
    2005             subClassifier.setAttributeNode(typeAttribute);
    2006             Attr attribute = doc.createAttribute(GSXML.NODE_ID_ATT);
    2007             attribute.setValue(classifierID+"."+count);
    2008             subClassifier.setAttributeNode(attribute);
     2007            subClassifier.setAttribute(GSXML.CHILD_TYPE_ATT, GSXML.VLIST);
     2008            subClassifier.setAttribute(GSXML.NODE_ID_ATT, classifierID+"."+count);
     2009            subClassifier.setAttribute(GSXML.CLASSIFIER_STYLE_ATT, GSXML.VLIST);
    20092010        }
    20102011        classifierNode.appendChild(subClassifier); // either way, append the subClassifier node
     
    23372338        }
    23382339       
    2339         // Build Greenstone XML Query response message for from
     2340        // Build Greenstone XML Query response message from
    23402341        // the pids (which should be document identifiers)
    23412342        Document doc = builder.newDocument();
     
    23452346                GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);
    23462347        Element metadata = doc.createElement(GSXML.METADATA_ELEM);
    2347        
    2348         Attr attribute = doc.createAttribute(GSXML.NAME_ATT);
    2349         attribute.setValue(NUM_DOCS_MATCHED);
    2350         metadata.setAttributeNode(attribute);
    2351        
    2352         attribute = doc.createAttribute(GSXML.VALUE_ATT);
    2353         attribute.setValue(Integer.toString(pids.length));
    2354         metadata.setAttributeNode(attribute);
    2355        
     2348        metadata.setAttribute(GSXML.NAME_ATT, NUM_DOCS_MATCHED);
     2349        metadata.setAttribute(GSXML.VALUE_ATT, Integer.toString(pids.length));     
     2350        metadataList.appendChild(metadata);
     2351
     2352        metadata = doc.createElement(GSXML.METADATA_ELEM);
     2353        metadata.setAttribute(GSXML.NAME_ATT, "numDocsReturned");
     2354        metadata.setAttribute(GSXML.VALUE_ATT, Integer.toString(pids.length));     
    23562355        metadataList.appendChild(metadata);
    23572356       
     
    23672366        for(int i = 0; i < pids.length; i++) {
    23682367            Element docNode = doc.createElement(GSXML.DOC_NODE_ELEM);
    2369             attribute = doc.createAttribute(GSXML.NODE_ID_ATT);
    2370             attribute.setValue(pids[i]);
    2371             docNode.setAttributeNode(attribute);
    2372            
    2373             attribute = doc.createAttribute(GSXML.DOC_TYPE_ATT);
    2374             attribute.setValue("hierarchy");
    2375             docNode.setAttributeNode(attribute);
    2376            
    2377             attribute = doc.createAttribute(GSXML.NODE_TYPE_ATT);
    2378             attribute.setValue("root");
    2379             docNode.setAttributeNode(attribute);
     2368            docNode.setAttribute(GSXML.NODE_ID_ATT, pids[i]);
     2369            docNode.setAttribute(GSXML.DOC_TYPE_ATT, "hierarchy");
     2370            docNode.setAttribute(GSXML.NODE_TYPE_ATT, "root");
     2371            docNode.setAttribute(GSXML.NODE_RANK_ATT, "NaN");
     2372
    23802373            docNodeList.appendChild(docNode);
    23812374        }
     
    23832376        Element responseMsg = createResponseMessage(doc, docNodeList, ex,
    23842377                GSXML.REQUEST_TYPE_PROCESS, service);
     2378       
     2379        //docNodeList.getParentNode().appendChild(metadataList); // need to add term info
     2380
    23852381        try{
    23862382            return FedoraCommons.elementToString(responseMsg);
  • other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/GSearchConnection.java

    r26286 r26309  
    208208        // for debugging
    209209        //javax.swing.JOptionPane.showMessageDialog(null, "GSearchConnection.gFindObjects:" + valueFound);
    210        
     210        //LOG.error("gfindObjects result: " + valueFound);
     211
    211212        return valueFound;
    212213    }
Note: See TracChangeset for help on using the changeset viewer.