Ignore:
Timestamp:
2012-09-27T18:37:00+12:00 (12 years ago)
Author:
ak19
Message:
  1. Now checks request for nodeStructureInfo documentType, as is needed to get it working with GS3 again. 2. Added in reusable constants of gsdl3/util/AbstractBasicDocument.java since these have now been made public constants.
File:
1 edited

Legend:

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

    r26262 r26270  
    2929import org.greenstone.fedora.services.FedoraGS3Exception.FedoraGS3RunException;
    3030import org.greenstone.fedora.services.FedoraGS3Exception.NotAFedoraServerException;
     31import org.greenstone.gsdl3.util.AbstractBasicDocument; // for constants
    3132import org.greenstone.gsdl3.util.GSXML;
    3233import org.w3c.dom.Document;
     
    888889            //    ...
    889890            // </nodeStructureInfo>
    890             Element nodeStructureInfo = doc.createElement(GSXML.NODE_STRUCTURE_ELEM+GSXML.INFO_ATT);
     891            Element nodeStructureInfo = doc.createElement(GSXML.NODE_STRUCTURE_ELEM+"Info");
    891892            Element root = srcDocElement.getOwnerDocument().getDocumentElement();
    892893           
    893             if(root.hasAttribute("numSiblings")) {
    894             String numSiblings = root.getAttribute("numSiblings");
     894            if(root.hasAttribute(AbstractBasicDocument.INFO_NUM_SIBS)) {
     895            String numSiblings = root.getAttribute(AbstractBasicDocument.INFO_NUM_SIBS);
    895896            Element infoEl = doc.createElement(GSXML.INFO_ATT);
    896             infoEl.setAttribute(GSXML.NAME_ATT, "numSiblings");
     897            infoEl.setAttribute(GSXML.NAME_ATT, AbstractBasicDocument.INFO_NUM_SIBS);
    897898            infoEl.setAttribute(GSXML.VALUE_ATT, numSiblings);
    898899            nodeStructureInfo.appendChild(infoEl);
    899900            }
    900901           
    901             if(root.hasAttribute("siblingPosition")) {
    902             String siblingPosition = root.getAttribute("siblingPosition");
     902            if(root.hasAttribute(AbstractBasicDocument.INFO_SIB_POS)) {
     903            String siblingPosition = root.getAttribute(AbstractBasicDocument.INFO_SIB_POS);
    903904            Element infoEl = doc.createElement(GSXML.INFO_ATT);
    904             infoEl.setAttribute(GSXML.NAME_ATT, "siblingPosition");
     905            infoEl.setAttribute(GSXML.NAME_ATT, AbstractBasicDocument.INFO_SIB_POS);
    905906            infoEl.setAttribute(GSXML.VALUE_ATT, siblingPosition);
    906907            nodeStructureInfo.appendChild(infoEl);
    907908            }
    908909           
    909             if(root.hasAttribute("numChildren")) {
    910             String numChildren = root.getAttribute("numChildren");
     910            if(root.hasAttribute(AbstractBasicDocument.INFO_NUM_CHILDREN)) {
     911            String numChildren = root.getAttribute(AbstractBasicDocument.INFO_NUM_CHILDREN);
    911912            Element infoEl = doc.createElement(GSXML.INFO_ATT);     
    912             infoEl.setAttribute(GSXML.NAME_ATT, "numChildren");
     913            infoEl.setAttribute(GSXML.NAME_ATT, AbstractBasicDocument.INFO_NUM_CHILDREN);
    913914            infoEl.setAttribute(GSXML.VALUE_ATT, numChildren);
    914915            nodeStructureInfo.appendChild(infoEl);
    915916            }
     917
     918            if(root.hasAttribute(AbstractBasicDocument.INFO_DOC_TYPE)) {
     919            String documentType = root.getAttribute(AbstractBasicDocument.INFO_DOC_TYPE);
     920            Element infoEl = doc.createElement(GSXML.INFO_ATT);     
     921            infoEl.setAttribute(GSXML.NAME_ATT, AbstractBasicDocument.INFO_DOC_TYPE);
     922            infoEl.setAttribute(GSXML.VALUE_ATT, documentType);
     923            nodeStructureInfo.appendChild(infoEl);
     924            }       
     925
    916926            docNode.appendChild(nodeStructureInfo);
    917927        }
     
    24782488            for(int i = 0; i < docIDs.length; i++) {
    24792489                System.out.println("Descendents and numChildren:\n"
    2480                            + con.getDocumentStructure(docIDs[i], new String[] {"descendants"}, new String[] {"numChildren"}));
     2490                           + con.getDocumentStructure(docIDs[i], new String[] {"descendants"}, new String[] {AbstractBasicDocument.INFO_NUM_CHILDREN}));
    24812491                System.out.println("Parent and numSiblings:\n"
    2482                            + con.getDocumentStructure(docIDs[i], new String[] {"parent"}, new String[] {"numSiblings"}));
     2492                           + con.getDocumentStructure(docIDs[i], new String[] {"parent"}, new String[] {AbstractBasicDocument.INFO_NUM_SIBS}));
    24832493            }
    24842494           
     
    24902500            System.out.println(con.getContent(errorCases));
    24912501            System.out.println(con.getDocumentMetadata(errorCases, new String[]{"all"}));
    2492                            System.out.println(con.getDocumentStructure(errorCases, new String[] {"descendants"}, new String[] {"numChildren"}));
     2502                           System.out.println(con.getDocumentStructure(errorCases, new String[] {"descendants"}, new String[] {AbstractBasicDocument.INFO_NUM_CHILDREN}));
    24932503           
    24942504            System.out.println("\nCLASSIFIER BROWSE");
Note: See TracChangeset for help on using the changeset viewer.