Document Search Results

Document search requests allow you to search for and retrieve one or more folders of document corresponding to a project identifier or project cube and specified selection information. You can also retrieve a document providing the document name and project cube. The icc.db.File class provides additional functionality to help you in storing and maintaining a hashtable of previously retrieved documents.

a. Retrieving a single folder of documents Given the successful data request, the resulting folder can be accessed and its documents stored as follows:

if (request.service().equals(File.QUERY))
    if (request.result() instanceof Folder) {
        Folder folder = (Folder) request.result();

        // store the folder's documents
        Enumeration enum = folder.files();
        while (enum.hasMoreElements()) {
	    Header doc = (Header) enum.nextElement();
	    if ((doc instanceof File) ||
                (File.get(doc.id()) == null))
	        doc.put();
	}
        ...
    }

b. Retrieving a vector of folders of documents Given the successful data request, the resulting vector of folders can be accessed and its documents stored as follows:

if (request.service().equals(File.QUERY))
    if (request.result() instanceof Vector) {
        Vector folders = (Vector) request.result();
        for (int n = 0; n < folders.size(); n++) {
            Folder fold = (Folder) folders.elementAt(n);

            // store the folder's documents
            Enumeration enum = fold.files();
            while (enum.hasMoreElements()) {
	        Header doc = (Header) enum.nextElement();
	        if ((doc instanceof File) ||
                    (File.get(doc.id()) == null))
	            doc.put();
	    }
        }
        ...
    }

c. Retrieving a vector of folders of document identifiers Given the successful data request, the resulting vector of folders can be accessed as follows:

if (request.service().equals(File.SEARCH))
    if (request.result() instanceof Vector) {
        Vector folders = (Vector) request.result();
        for (int n = 0; n < folders.size(); n++) {
            Folder fold = (Folder) folders.elementAt(n);

            // access the folder's document identifiers
            Vector ids = fold.view();
            ...
        }
        ...
    }

d. Retrieving a document providing the document name and project cube The result cannot be distinguished from the result of a document retrieval by document identifier. See document results on how to deal with such a result.


Last modified on 27 May 1999 by Rudi Stouffs

This website has been archived and is no longer maintained.