Interface OracleCollection
-
public interface OracleCollection
A collection of documents.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OracleCollectionAdmin
admin()
Gets anOracleCollectionAdmin
objectOracleOperationBuilder
find()
Returns anOracleOperationBuilder
representing an operation that finds all documents in the collection.OracleDocument
findOne(String key)
Finds anOracleDocument
matching a key.void
insert(Iterator<OracleDocument> documents)
Inserts multiple documents into the collection.void
insert(OracleDocument document)
Inserts a document into the collection.List<OracleDocument>
insertAndGet(Iterator<OracleDocument> documents)
Inserts multiple documents into the collection.List<OracleDocument>
insertAndGet(Iterator<OracleDocument> documents, Map<String,?> options)
Inserts multiple documents into the collection with options.OracleDocument
insertAndGet(OracleDocument document)
Inserts a document into the collection.OracleDocument
insertAndGet(OracleDocument document, Map<String,?> options)
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.OracleDocument
saveAndGet(OracleDocument document, Map<String,?> options)
Saves a document into the collection.
-
-
-
Method Detail
-
find
OracleOperationBuilder find()
Returns anOracleOperationBuilder
representing an operation that finds all documents in the collection.- Returns:
OracleOperationBuilder
-
findOne
OracleDocument findOne(String key) throws OracleException
Finds anOracleDocument
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 benull
- Returns:
OracleDocument
matching the key.null
if not found.- Throws:
OracleException
- if the key isnull
-
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 benull
- Throws:
OracleException
- if (1) the inputdocument
isnull
, 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 benull
- 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 inputdocument
isnull
, 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, Map<String,?> options) 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 benull
options
-null
or aMap
of options. The key is option name and the value is the option value. The semantics of the options are implementation defined. "hint" is a valid key with string value containing one or more insert hints.- 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 inputdocument
isnull
, 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 or (6) the value of the hint supplied through options is not of string type or contains substring "/*" or "\*\/"
-
save
void save(OracleDocument document) throws OracleException
Saves a document into the collection. This method is equivalent toinsert(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 benull
- Throws:
OracleException
- if (1) the inputdocument
isnull
, 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 toinsertAndGet(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 benull
- 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 inputdocument
isnull
, 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, Map<String,?> options) throws OracleException
Saves a document into the collection. This method is equivalent toinsertAndGet(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 benull
options
-null
or aMap
of options. The key is option name and the value is the option value. The semantics of the options are implementation defined. "hint" is a valid key with string value containing one or more save hints.- 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 inputdocument
isnull
, 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 or (5) the value of the hint supplied through options is not of string type or contains substring "/*" or "\*\/"
-
insert
void insert(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. InvokingOracleBatchException.getProcessed()
method returns the number of document processed successfully before the error occurred.- Parameters:
documents
- anIterator
over input documents. Cannot benull
. Documents cannot havekey
s if the collection is configured to auto-generate keys.- Throws:
OracleBatchException
- if (1) the inputdocuments
Iterator
isnull
, 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
List<OracleDocument> insertAndGet(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. InvokingOracleBatchException.getProcessedCount()
method returns the number of document processed successfully before the error occurred.- Parameters:
documents
- an iterator over input documents. Cannot benull
. Documents cannot havekey
s 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 inputdocuments
Iterator
isnull
, 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
List<OracleDocument> insertAndGet(Iterator<OracleDocument> documents, Map<String,?> options) throws OracleBatchException
Inserts multiple documents into the collection with options.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. InvokingOracleBatchException.getProcessedCount()
method returns the number of document processed successfully before the error occurred.- Parameters:
documents
- an iterator over input documents. Cannot benull
. Documents cannot havekey
s if the collection is configured to auto-generate keysoptions
-null
or aMap
of options. The key is option name and the value is the option value. The semantics of the options are implementation defined. Valid hints are:"hint" with string value containing one or more insert hints.
"maxBatchSize" with Integer value representing the desired batch size.
- 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 inputdocuments
Iterator
isnull
, 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 or (6) the value of the hint supplied through options is not of string type or contains substring "/*" or "\*\/"
-
admin
OracleCollectionAdmin admin()
Gets anOracleCollectionAdmin
object- Returns:
- a
OracleCollectionAdmin
object
-
-