Ignore:
Timestamp:
2010-03-26T18:37:14+13:00 (14 years ago)
Author:
ak19
Message:

Browse takes a list of classifierIDs, not a single one.

File:
1 edited

Legend:

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

    r21775 r21835  
    161161     * administrative password and username of the fedora server showing
    162162     * the values in the properties file as default. If the necessary
    163      * initialisation are not present in the file, they corresponding fields
     163     * initialisation are not present in the file, the corresponding fields
    164164     * in the dialog will be blank.
    165165     * If no password was set on the fedora repository when installing it,
     
    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).
     1303     * All collections in this Digital Library (Fedora Repository) share the
     1304     * same services, so this method returns the same services as getServiceList();
    13061305     * @param collectionName - the name of the collection whose services are to
    13071306     * be described. It will be converted to a fedora collection pid, which is of
     
    16791678     * user to browse the titles of documents in the given collection by letter
    16801679     * and returning the results.
    1681      * @param classifierID is the id of the classifier on which to browse. In
     1680     * @param classifierIDs are the ids of the classifiers on which to browse. In
    16821681     * this case, the classifier indicates whether we browse titles by letter, or
    16831682     * browse (documents) by collection; and it is of the form <CL(letter)>.
     
    16871686     * the documents that start with the letter indicated by parameter classifier.
    16881687    */
    1689     public String browse(String collectionName, String classifierID)
     1688    public String browse(String collectionName, String[] classifierIDs)
    16901689    {
    16911690        Document doc = builder.newDocument();
     
    16961695                GSXML.CLASS_NODE_ELEM+GSXML.LIST_MODIFIER);
    16971696       
     1697    for(int i = 0; i < classifierIDs.length; i++) {
    16981698        // <classifierNode nodeID="classifierNum">
    16991699        Element requestedClassifierNode = doc.createElement(
    17001700                GSXML.CLASS_NODE_ELEM);
    17011701        Attr attribute = doc.createAttribute(GSXML.NODE_ID_ATT);
    1702         attribute.setValue(classifierID);
     1702        attribute.setValue(classifierIDs[i]);
    17031703        requestedClassifierNode.setAttributeNode(attribute);
    17041704        classifierNodeList.appendChild(requestedClassifierNode);
     
    17111711        Element classifierNode = doc.createElement(GSXML.CLASS_NODE_ELEM);
    17121712        attribute = doc.createAttribute(GSXML.NODE_ID_ATT);
    1713         attribute.setValue(classifierID);
     1713        attribute.setValue(classifierIDs[i]);
    17141714        classifierNode.setAttributeNode(attribute);
    17151715        nodeStructure.appendChild(classifierNode);
     
    17191719        // classifier CL2 = browse by collection;
    17201720        //remove the CL prefix and obtain the number from the id:
    1721         int classifierNum = Integer.parseInt(classifierID.replace("CL", ""));
     1721        int classifierNum = Integer.parseInt(classifierIDs[i].replace("CL", ""));
    17221722        switch(classifierNum) {
    17231723            case 1:
     
    17271727                    // Retrieve the document structure for each subClassifierID:
    17281728                    // all the documents that begin with its letter.
    1729                     // remove the starting CL
    17301729                    String letter = String.valueOf(ch);
    1731                     try{
     1730                    try {
    17321731                    String[] docPIDs = this.browseTitlesByLetter(
    17331732                             collectionName, letter);
     
    17401739                          GSXML.CLASS_NODE_ELEM);
    17411740                    attribute = doc.createAttribute(GSXML.NODE_ID_ATT);
    1742                     attribute.setValue(classifierID+"."+num);
     1741                    attribute.setValue(classifierIDs[i]+"."+num);
    17431742                    subClassifier.setAttributeNode(attribute);
    17441743                    classifierNode.appendChild(subClassifier);
     
    17601759                            GSXML.CLASS_NODE_ELEM);
    17611760                    attribute = doc.createAttribute(GSXML.NODE_ID_ATT);
    1762                     attribute.setValue(classifierID+"."+0); //
     1761                    attribute.setValue(classifierIDs[i]+"."+0); //
    17631762                    subClassifier.setAttributeNode(attribute);
    17641763                    classifierNode.appendChild(subClassifier);
     
    17691768            default:
    17701769                ex = new FedoraGS3RunException( // cause is regular exception
    1771                     new Exception("Unknown classifier ID: " + classifierID));
    1772         }
     1770                    new Exception("Unknown classifier ID: " + classifierIDs[i]));
     1771        }
     1772    }
    17731773        Element responseMsg = createResponseMessage(doc, classifierNodeList, ex,
    17741774                GSXML.REQUEST_TYPE_DESCRIBE, collectionName+"/ClassifierBrowse");
     
    22092209            System.out.println("\nCLASSIFIER BROWSE");
    22102210            System.out.println(con.browse("gs2mgdemo", //"ClassifierBrowse",
    2211                     "CL1"));
     2211                              new String[]{"CL1"}));
    22122212           
    22132213            System.out.println("\nCLASSIFIER BROWSE METADATA RETRIEVE");
Note: See TracChangeset for help on using the changeset viewer.