DocumentCollection (Java)

Represents a collection of documents from a database, selected according to specific criteria.

Syntax

public class DocumentCollection extends NotesBase

Containment

Contained by: AgentContext, Database, View

Contains: Document

Properties

Count through getCount

IsSorted through isSorted

Parent through getParent

Query through getQuery

UntilTime through getUntilTime

Methods

addDocument

clone

contains

deleteDocument

FTSearch

getDocument

getFirstDocument

getLastDocument

getNextDocument

getNthDocument

getPrevDocument

intersect

markAllRead

markAllUnread

merge

putAllInFolder

recycle

removeAll

removeAllFromFolder

stampAll

stampAllMulti method

subtract

updateAll

Access

A DocumentCollection represents a subset of all the documents in a database. The documents in the subset are determined by the method or property you use to search the database, which can be any of the following:

  • getAllDocuments in Database
  • FTSearch in Database
  • FTSearchRange in Database

  • search in Database
  • getProfileDocCollection in Database
  • getModifiedDocuments in Database

  • getAllDocumentsByKey in View
  • getUnprocessedDocuments in AgentContext
  • unprocessedFTSearch in AgentContext
  • unprocessedFTSearchRange in AgentContext

  • unprocessedSearch in AgentContext
  • getResponses in Document

Usage

DocumentCollection, ViewEntryCollection, and ViewNavigator objects provide access to documents in a database. Use a DocumentCollection object if:

  • You want to act on a specific set of documents that meet certain criteria.
  • There is no view in the database that contains every document you need to search.
  • You do not need to navigate the documents' response hierarchies.

Views are a more efficient means of accessing documents because they are already indexed by the database itself. However, they do not necessarily provide access to the documents that you want. ViewEntryCollection and ViewNavigator provide access to view entries, which contain ViewEntry as well as Document information. ViewNavigator provides access to categories and totals as well as documents.

Sorted collections

The documents in a collection are not sorted unless the collection results from a search. By contrast, documents accessed through ViewEntryCollection and ViewNavigator are in view order.

Current® pointer

A current pointer is maintained for document collections. All navigation methods set the current pointer to the retrieved document with the following exceptions: add and delete methods do not move the current pointer. The following methods set the current pointer to the first document: FTSearch, removeAll (remote IIOP only), putAllInFolder, removeAllFromFolder, and stampAll.

Deletion stubs

A deletion stub is returned for a document deleted after creation of the collection or for a document to which you do not have Reader access. Use isValid in Document to check whether a document is real (true) or a deletion stub (false).

Example