Changeset 21775

Show
Ignore:
Timestamp:
11.03.2010 16:45:58 (10 years ago)
Author:
ak19
Message:

FedoraConnection?.java changed to work with files that have no TOC (Table of Contents) because they have only 1 section. Other source files only have cosmetic changes.

Location:
other-projects/gs3-webservices-java-client/trunk/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/SearchResultsDisplay.java

    r15222 r21775  
    323323            String docContent = docNode.getContent(); 
    324324            if(docContent != null) { 
    325                 docContent = docContent.replaceAll( 
    326                         "ALIGN=\"JUSTIFY\"", "ALIGN=\"LEFT\""); 
     325                docContent = docContent.replaceAll( 
     326                    "ALIGN=\"JUSTIFY\"", "ALIGN=\"LEFT\""); 
    327327            } 
    328             this.docContentEditPane.setText(docContent); 
     328 
     329        this.docContentEditPane.setText(docContent); 
    329330            this.docContentEditPane.setCaretPosition(0); // set 'cursor' at top 
    330331        } 
  • other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraConnection.java

    r15659 r21775  
    766766     
    767767    /** All "greenstone:*" objects in fedora (be they collections or documents)  
    768      * have a TOC datastream. This method returns the content (XML) of the TOC   
    769      * datastream as is. (Calls default fedora-system 3 dissemination <pid>/TOC.) 
     768     * have a TOC datastream, unless they have only 1 section (SECTION1).  
     769     * This method returns the content (XML) of the TOC datastream as is. 
     770     * (Calls default fedora-system 3 dissemination <pid>/TOC.) 
    770771     * @return a String version of the XML in the TOC datastream for the fedora 
    771772     * object denoted by pid. 
     
    780781        throws RemoteException, UnsupportedEncodingException  
    781782    { 
     783        try { 
    782784        MIMETypedStream tocStream = APIA.getDatastreamDissemination(pid, TOC, null); 
    783785            //asOfDateTime = null to get the current version of the dataStream 
    784          
    785786        // need to set the charset encoding to UTF8 
    786787        return new String(tocStream.getStream(), UTF8); 
     788        } catch(RemoteException re) { 
     789        // if TOC does not exist, then it means there is only 1 section, dsID: SECTION1 
     790        return new String("<Section id=\"1\"></Section>".getBytes(), UTF8); //set charset 
     791        }        
    787792    } 
    788793     
     
    13171322        // If sectionNumber=1, then the top-level element/document element 
    13181323        // of the TOC XML is requested, so return the TOC as is. 
    1319         if(sectionNumber.equals("1")) 
     1324        if(sectionNumber.equals("1")) { 
    13201325            return docEl; 
     1326        } 
    13211327         
    13221328        // Get all <Section> elements and find the 
  • other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraGS3Connection.java

    r21573 r21775  
    10351035                // set the text content to what was retrieved 
    10361036                Element nodeContent = doc.createElement(GSXML.NODE_CONTENT_ELEM); 
    1037                 Text textNode = doc.createTextNode(sectionContent); 
     1037                Text textNode = doc.createTextNode(sectionContent.trim()); 
    10381038                 
    10391039                nodeContent.appendChild(textNode); 
     
    13011301     * serviceNames: DocumentContent/Metadata/StructureRetrieve, ClassifierBrowse, 
    13021302     * ClassifierBrowseMetadataRetrieve.    
     1303     * All collections in this Digital Library (Fedora Repository) share  
     1304     * the same services, so this method returns the same as  
     1305     * describeService(serviceName). 
    13031306     * @param collectionName - the name of the collection whose services are to 
    13041307     * be described. It will be converted to a fedora collection pid, which is of  
     
    13331336     * return nothing special except their names; browse (and any query) 
    13341337     * return more complex XML responses. 
    1335      * All collections in this Digital Library (Fedora Repository) share  
    1336      * the same services, so this method returns the same as  
    1337      * describeService(serviceName).  
    13381338     * @param serviceName - the name of the service in the collection which is to  
    13391339     * be described.*/ 
     
    13551355        attribute = doc.createAttribute(GSXML.TYPE_ATT); 
    13561356         
    1357         if(serviceName.toLowerCase().endsWith("retrieve")) 
     1357        if(serviceName.toLowerCase().endsWith("retrieve")) { 
    13581358            attribute.setValue(GSXML.SERVICE_TYPE_RETRIEVE); 
    1359          
     1359        }  
    13601360        else if(serviceName.toLowerCase().contains("browse")) { 
    13611361            attribute.setValue(GSXML.SERVICE_TYPE_BROWSE); 
     
    13901390        else if(serviceName.toLowerCase().contains("query")) { 
    13911391            attribute.setValue(GSXML.SERVICE_TYPE_QUERY); 
    1392             if(serviceName.equals("TextQuery")) 
     1392            if(serviceName.equals("TextQuery")) { 
    13931393                describeTextQueryService(service); 
    1394             else if(serviceName.equals("FieldQuery")) 
     1394            } else if(serviceName.equals("FieldQuery")) { 
    13951395                describeFieldQueryService(service); 
     1396            } 
    13961397        } 
    13971398         
     
    20452046                // there may be fewer searchTerms than fieldNames (since some 
    20462047                // fieldNames may have been left empty), so loop on searchTerms 
    2047                 if(map.containsKey(fieldNames[i])) { //fieldName is already  
     2048                if(map.containsKey(fieldNames[i])) { // fieldName is already  
    20482049                    // in the list, so append comma with new value 
    20492050                    String termsList = (String)map.get(fieldNames[i]);