oracle.soda
Interface OracleCollection


public interface OracleCollection

A collection of documents.


Method Summary
 OracleCollectionAdmin admin()
          Gets an OracleCollectionAdmin object
 OracleOperationBuilder find()
          Returns an OracleOperationBuilder representing an operation that finds all documents in the collection.
 OracleDocument findOne(java.lang.String key)
          Finds an OracleDocument matching a key.
 void insert(java.util.Iterator<OracleDocument> documents)
          Inserts multiple documents into the collection.
 void insert(OracleDocument document)
          Inserts a document into the collection.
 java.util.List<OracleDocument> insertAndGet(java.util.Iterator<OracleDocument> documents)
          Inserts multiple documents into the collection.
 OracleDocument insertAndGet(OracleDocument document)
          Inserts a document into the collection.
 void save(OracleDocument document)
          Saves a document into the collection.
 OracleDocument saveAndGet(OracleDocument document)
          Saves a document into the collection.
 

Method Detail

find

OracleOperationBuilder find()
Returns an OracleOperationBuilder representing an operation that finds all documents in the collection.

Returns:
OracleOperationBuilder

findOne

OracleDocument findOne(java.lang.String key)
                       throws OracleException
Finds an OracleDocument matching a key.

This is a convenience method. The same operation can be expressed as: col.find().key("k1").getOne()

Parameters:
key - the key. Cannot be null
Returns:
OracleDocument matching the key. null if not found.
Throws:
OracleException - if the key is null

insert

void insert(OracleDocument document)
            throws OracleException
Inserts a document into the collection.

The key will be automatically created, unless this collection is configured with client-assigned keys and the key is provided in the input document.

Parameters:
document - input document. Cannot have a key if the collection is configured to auto-generate keys. Cannot be null
Throws:
OracleException - if (1) the input document is null, or (2) keys are client-assigned for this collection, but the key is not provided in the input document, or (3) keys are client-assigned for this collection, and the key provided in the input document already exists in the collection, or (4) keys are auto-generated for this collection, and the key is provided in the input document, or (5) an error during insertion occurs

insertAndGet

OracleDocument insertAndGet(OracleDocument document)
                            throws OracleException
Inserts a document into the collection.

The key will be automatically created, unless this collection is configured with client-assigned keys and the key is provided in the input document.

Parameters:
document - input document. Cannot have a key if the collection is configured to auto-generate keys. Cannot be null
Returns:
result document which contains the key and (if present) the created-on timestamp, last-modified timestamp, and version only. The input document's content is not returned as part of the result document.
Throws:
OracleException - if (1) the input document is null, or (2) keys are client-assigned for this collection, but the key is not provided in the input document, or (3) keys are client-assigned for this collection, and the key provided in the input document already exists in the collection, or (4) keys are auto-generated for this collection, and the key is provided in the input document, or (5) an error during insertion occurs

save

void save(OracleDocument document)
          throws OracleException
Saves a document into the collection. This method is equivalent to insert(OracleDocument) except that if client-assigned keys are used, and the document with the specified key already exists in the collection, it will be replaced with the input document.

The key will be automatically created, unless this collection is configured with client-assigned keys and the key is provided in the input document.

Parameters:
document - input document. Cannot have a key if the collection is configured to auto-generate keys. Cannot be null
Throws:
OracleException - if (1) the input document is null, or (2) keys are client-assigned for this collection, but the key is not provided in the input document, or (3) keys are auto-generated for this collection, and the key is provided in the input document, or (4) an error during insertion occurs

saveAndGet

OracleDocument saveAndGet(OracleDocument document)
                          throws OracleException
Saves a document into the collection. This method is equivalent to insertAndGet(OracleDocument) except that if client-assigned keys are used, and the document with the specified key already exists in the collection, it will be replaced with the input document.

The key will be automatically created, unless this collection is configured with client-assigned keys and the key is provided in the input document.

Parameters:
document - input document. Cannot have a key if the collection is configured to auto-generate keys. Cannot be null
Returns:
result document which contains the key and (if present) the created-on timestamp, last-modified timestamp, and version only. The input document's content is not returned as part of the result document.
Throws:
OracleException - if (1) the input document is null, or (2) keys are client-assigned for this collection, but the key is not provided in the input document, or (3) keys are auto-generated for this collection, and the key is provided in the input document, or (4) an error during insertion occurs

insert

void insert(java.util.Iterator<OracleDocument> documents)
            throws OracleBatchException
Inserts multiple documents into the collection.

The keys will be automatically created, unless this collection has client-assigned keys and the key is provided in the input document.

If there is an error inserting one of the documents, OracleBatchException will be thrown. Invoking OracleBatchException.getProcessed() method returns the number of document processed successfully before the error occurred.

Parameters:
documents - an Iterator over input documents. Cannot be null. Documents cannot have keys if the collection is configured to auto-generate keys.
Throws:
OracleBatchException - if (1) the input documents Iterator is null, or (2) keys are client-assigned for this collection, but the key is not provided for one or more of the input documents, or (3) keys are client-assigned for this collection, and the key provided for one or more of the input documents already exists in the collection, or (4) keys are auto-generated for this collection, but the key is provided in one or more input documents, or (5) if an error during insertion occurs

insertAndGet

java.util.List<OracleDocument> insertAndGet(java.util.Iterator<OracleDocument> documents)
                                            throws OracleBatchException
Inserts multiple documents into the collection.

The keys will be automatically created, unless this collection has client-assigned keys and the key is provided in the input document.

If there is an error inserting one of the documents, OracleBatchException will be thrown. Invoking OracleBatchException.getProcessed() method returns the number of document processed successfully before the error occurred.

Parameters:
documents - an iterator over input documents. Cannot be null. Documents cannot have keys if the collection is configured to auto-generate keys
Returns:
an list of result documents, each of which contains the key and (if present) the created-on timestamp, last-modified timestamp, and version only. The input documents' contents are not returned as part of the result documents.
Throws:
OracleBatchException - if (1) the input documents Iterator is null, or (2) keys are client-assigned for this collection, but the key is not provided for one or more of the input documents, or (3) keys are client-assigned for this collection, and the key provided for one or more of the input documents already exists in the collection, or (4) keys are auto-generated for this collection, but the key is provided in one or more input documents, or (5) if an error during insertion occurs

admin

OracleCollectionAdmin admin()
Gets an OracleCollectionAdmin object

Returns:
a OracleCollectionAdmin object