Ignore:
Timestamp:
2010-03-11T16:45:58+13:00 (14 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.