com.hcl.domino.db Reference
This page describes each domino-db class and function in detail. To navigate between sections, use the table of contents on the right.
Database class
createDocument
Creates a document.
Parameters
options
{Object
}
document
{Object
} REQUIRED - The new document contents. See domino-db document schema for information about representing a document as a JavaScript object.accessToken
{string
} An optional access token. See OptionalAccessToken for details.computeOptions
{Object
} An optional object specifying how to compute items on the new document. See Compute with form for details.duplicateItems
{boolean
} An optional boolean value used to create duplicate items in the new document. See Duplicate items for details.
Return Value
{
ListenableFuture
<Document
>} A promise resolved with new document
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
List<Item<?>> itemList = new ArrayList<Item<?>>();
itemList.add(new TextItem("Form","Contact"));
itemList.add(new TextItem("FirstName","Aaron"));
itemList.add(new TextItem("LastName","Aardman"));
itemList.add(new TextItem("City","Arlington"));
itemList.add(new TextItem("State","MA"));
Document response = client.createDocument(new Document(itemList)).get();
createDocuments
Creates multiple documents. To create a single document, see Database::createDocument.
Parameters
options
{Object
}
documents
{Array
<Object
>} REQUIRED - An array of new documentsaccessToken
{string
} An optional access token. See OptionalAccessToken for details.computeOptions
{Object
} An optional object specifying how to compute items on the new documents. See Compute with form for details.onErrorOptions
{string
} A optional string specifying what to do when an error occurs. Must be either"ON_ERROR_CONTINUE"
or"ON_ERROR_ABORT_REMAINING"
.duplicateItems
{boolean
} An optional boolean value used to create duplicate items in the new documents. See Duplicate items for details.
Return Value
{
ListenableFuture
<List<Document>
>} A ListenableFuture resolved with a list of Documents.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
List<Document> documentList = new ArrayList<Document>();
List<Item<?>> itemList1 = new ArrayList<Item<?>>();
itemList.add(new TextItem("Form","Contact"));
itemList.add(new TextItem("FirstName","Aaron"));
itemList.add(new TextItem("LastName","Aardman"));
itemList.add(new TextItem("City","Arlington"));
itemList.add(new TextItem("State","MA"));
List<Item<?>> itemList2 = new ArrayList<Item<?>>();
itemList.add(new TextItem("Form","Contact"));
itemList.add(new TextItem("FirstName","Brian"));
itemList.add(new TextItem("LastName","Aardman"));
itemList.add(new TextItem("City","Andover"));
itemList.add(new TextItem("State","MA"));
documentList.add(itemList1);
documentList.add(itemList2);
List<Document> response = client.createDocument(documentList).get();
getWriteAttachmentMgr
Creates a manager for writing one or more attachments
Parameters
options
{Object
}
accessToken
{string
} An optional access token. See OptionalAccessToken for details.
Return Value
{
WriteAttachmentMgr
} A object of a writable attachment manager. See Writing attachments for details on writing to the manager.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
WriteAttachmentMgr write = client.getWriteAttachmentMgr();
getWriteRichTextMgr
Creates a RichText manager object for writing one or more rich text fields.
Parameters
options
{Object
}
accessToken
{string
} An optional access token. See OptionalAccessToken for details.
Return Value
A writable rich text manager object. See Writing rich text for details on writing to the stream.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
WriteRichTextMgr rtWriteMgr = client.getWriteRichTextMgr();
readDocuments
Reads all documents matching a query string. For the query syntax, see Domino Query Langauge.
Parameters
options
{Object
}
query
{string
} REQUIRED - A query string.
accessToken
{string
} An optional access token. See OptionalAccessToken for details.
queryArgs
{Array
<Object
>} An optional array of values to substitute in the query string. See Query arguments for details.
queryLimits
{Object
} An optional set of limits on the query.
maxViewEntriesScanned
{number
} The maximum number of view entries to scan.maxDocumentsScanned
{number
} The maximum number of documents to scan.maxMilliSeconds
{number
} The maximum number of milliseconds to spend executing the query.
itemNames
{Array
<string
>} An optional array of item names. Use this option to read selected items. The default is to read no document items.
start
{number
} An optional zero-based start index. Use this to page through a large set of matching documents.
count
{number
} An optional count of the maximum number of documents to read.Note: If you don't specify the optional count, the default value is 100. The "DOCUMENT LIMITS" configuration setting determines the maximum number of documents that can be read, up to 1000.
computeOptions
{Object
} An optional object specifying how to compute items on the specified documents. See Compute with form for details.
readAttachmentSummaries
{boolean
} An optional boolean value specifying whether to read attachment summaries as described in @attachments.
onErrorOptions
{string
} A optional string specifying what to do when an error occurs. Must be either"ON_ERROR_CONTINUE"
or"ON_ERROR_ABORT_REMAINING"
.
canonicalFormat
{boolean
} An optional boolean value used to return item properties in canonical format, as objects. See Reading items in canonical format for details.
duplicateItems
{boolean
} An optional boolean value used to return duplicate items. See Duplicate items for details.
Return Value
{
ListenableFuture
<List<Document>
>} A ListenableFuture resolved with a list of Documents.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
String query = "'Contact' and FirstName = 'fname'";
List<Document> responseDocs = client.readDocuments(query).get();
readDocumentsByUnid
Reads multiple documents by UNID. To read a single document, see Document::read.
Parameters
options
{Object
}
unids
{Array
<string
>} REQUIRED - An array of UNIDs.accessToken
{string
} An optional access token. See OptionalAccessToken for details.itemNames
{Array
<string
>} An optional array of item names. Use this option to read selected items. The default is to read no document items.computeOptions
{Object
} An optional object specifying how to compute items on the specified documents. See Compute with form for details.readAttachmentSummaries
{boolean
} An optional boolean value specifying whether to read attachment summaries as described in @attachments.onErrorOptions
{string
} A optional string specifying what to do when an error occurs. Must be either"ON_ERROR_CONTINUE"
or"ON_ERROR_ABORT_REMAINING"
.canonicalFormat
{boolean
} An optional boolean value used to return item properties in canonical format, as objects. See Reading items in canonical format for details.duplicateItems
{boolean
} An optional boolean value used to return duplicate items. See Duplicate items for details.
Return Value
{
ListenableFuture
<List<Document>
>} A ListenableFuture resolved with a list of Documents.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
List<Document> responseDocs = client.readDocumentsByUnid(
Sets.newHashSet(
"28438659F50E2637852582C600038599",
"5B5544335FA7D893852582C60003859A")).get();
getReadAttachmentMgr
Reads attachments from all documents matching a query string.
Parameters
options
{Object
}
query
{string
} REQUIRED - A query string.accessToken
{string
} An optional access token. See OptionalAccessToken for details.queryArgs
{Array
<Object
>} An optional array of values to substitute in the query string. See Query arguments for details.queryLimits
{Object
} An optional set of limits on the query.
maxViewEntriesScanned
{number
} The maximum number of view entries to scan.maxDocumentsScanned
{number
} The maximum number of documents to scan.maxMilliSeconds
{number
} The maximum number of milliseconds to spend executing the query.fileNames
{Array
<string
>} An optional array of attachment file names. If specified, only matching attachments are streamed. If not specified, ALL attachments are streamed.chunkSizeKb
{number
} An optional stream chunk size in kilobytes. If the specified number is not allowed by the server, the closest allowable chunk size is used.
Return Value
{
ReadAttachmentMgr
} A ReadAttachmentMgr object of a readable attachment manager. See Reading attachments for details on reading from the manager.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
ReadAttachmentMgr readAttachmentMgr = client.getReadAttachmentMgr("Form = 'Contact' and LastName = 'Aardman'");
getReadAttachmentMgrByUnid
Reads attachments from a set of documents specified by UNID.
Parameters
options
{Object
}
unids
{Array
<string
>} REQUIRED - An array of UNIDs.accessToken
{string
} An optional access token. See OptionalAccessToken for details.fileNames
{Array
<string
>} An optional array of attachment file names. If specified, only matching attachments are streamed. If not specified, ALL attachments are streamed.chunkSizeKb
{number
} An optional stream chunk size in kilobytes. If the specified number is not allowed by the server, the closest allowable chunk size is used.
Return Value
{
ReadAttachmentMgr
} ReadAttachmentMgr object of a readable attachment manager. See Reading attachments for details on reading from the manager.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
ReadAttachmentMgr readAttachmentMgr =
client.getReadAttachmentMgrByUnid(Sets.newHashSet("28438659F50E2637852582C600038599",
"5B5544335FA7D893852582C60003859A"));
getReadRichTextMgr
Reads rich text from all documents matching a query string.
Parameters
options
{Object
}
query
{string
} REQUIRED - A query string.fields
{Array
<string
>} REQUIRED - An array of rich text item names. Repeating items with the same name will be concatenated into a single stream without the data type word.accessToken
{string
} An optional access token. See OptionalAccessToken for details.queryArgs
{Array
<Object
>} An optional array of values to substitute in the query string. See Query arguments for details.queryLimits
{Object
} An optional set of limits on the query.
maxViewEntriesScanned
{number
} The maximum number of view entries to scan.maxDocumentsScanned
{number
} The maximum number of documents to scan.maxMilliSeconds
{number
} The maximum number of milliseconds to spend executing the query.chunkSizeKb
{number
} An optional stream chunk size in kilobytes. If the specified number is not allowed by the server, the closest allowable chunk size is used.
Return Value
A read rich text manager object. See Reading Rich Text for details on reading from the stream.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
ErrorHandler<DocumentException> errHandler = new ErrorHandler<DocumentException>() {
@Override
public void onErrorHandler(DocumentException dominoDbException) {
System.out.println("Exception" + dominoDbException.getMessage());
}
};
Database client = server.useDatabase(TARGET_DATABASE);
OptionalChunkSizeKb chunkSize = new OptionalChunkSizeKb(32);
ReadRichTextMgr readManager = client.getReadRichTextMgr(
query: "Form = 'Contact' and LastName = 'Aardman'",
Sets.newHashSet("Body", "RichText2", "RichText3"),
errHandler,
chunkSize);
getReadRichTextMgrByUnid
Reads rich text from a set of documents specified by UNID.
Parameters
options
{Object
}
unids
{Array
<string
>} REQUIRED - An array of UNIDs.fields
{Array
<string
>} REQUIRED - An array of rich text item names. Repeating items with the same name will be concatenated into a single stream without the data type word.accessToken
{string
} An optional access token. See OptionalAccessToken for details.chunkSizeKb
{number
} An optional stream chunk size in kilobytes. If the specified number is not allowed by the server, the closest allowable chunk size is used.
Return Value
A read rich text manager object. See Reading Rich Text for details on reading from the stream.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
OptionalChunkSizeKb chunkSize = new OptionalChunkSizeKb(32);
ReadRichTextMgr readManager = client.getReadRichTextMgrByUnid(
Sets.newHashSet("28438659F50E2637852582C600038599", "5B5544335FA7D893852582C60003859A"),
Sets.newHashSet("Body", "RichText2", "RichText3"),
chunkSize);
deleteDocuments
Deletes all documents matching a query string.
Parameters
options
{Object
}
query
{string
} REQUIRED - A query string.accessToken
{string
} An optional access token. See OptionalAccessToken for details.queryArgs
{Array
<Object
>} An optional array of values to substitute in the query string. See Query arguments for details.queryLimits
{Object
} An optional set of limits on the query. See readDocuments for details.start
{number
} An optional zero-based document start index.count
{number
} An optional count of the maximum number of documents to delete.onErrorOptions
{string
} A optional string specifying what to do when an error occurs. Must be either"ON_ERROR_CONTINUE"
or"ON_ERROR_ABORT_REMAINING"
.
Return Value
{
ListenableFuture
<List<Document>
>} A ListenableFuture resolved with a list of Documents.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
List<Document> responseDocs = client.deleteDocuments("Form = 'Contact' and LastName = 'Aardman'").get();
deleteDocumentsByUnid
Deletes multiple documents by UNID. To delete a single document, see Document::delete.
Parameters
options
{Object
}
unids
{Array
<string
>} REQUIRED - An array of UNIDs.accessToken
{string
} An optional access token. See OptionalAccessToken for details.onErrorOptions
{string
} A optional string specifying what to do when an error occurs. Must be either"ON_ERROR_CONTINUE"
or"ON_ERROR_ABORT_REMAINING"
.
Return Value
{
ListenableFuture
<List<Document>
>} A ListenableFuture resolved with a list of Documents.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
List<Document> responseDocs = client.deleteDocumentsByUnid(
Sets.newHashSet("28438659F50E2637852582C600038599",
"5B5544335FA7D893852582C60003859A")).get();
deleteItems
Deletes selected items in all documents matching a query string.
Parameters
options
{Object
}
query
{string
} REQUIRED -- A query string.itemNames
{Array
<string
>} REQUIRED - An array of item namesaccessToken
{string
} An optional access token. See OptionalAccessToken for details.queryArgs
{Array
<Object
>} An optional array of values to substitute in the query string. See Query arguments for details.queryLimits
{Object
} An optional set of limits on the query. See readDocuments for details.start
{number
} An optional zero-based document start index.count
{number
} An optional count of the maximum number of documents to process.computeOptions
{Object
} An optional object specifying how to compute items on the specified documents. See Compute with form for details.onErrorOptions
{string
} A optional string specifying what to do when an error occurs. Must be either"ON_ERROR_CONTINUE"
or"ON_ERROR_ABORT_REMAINING"
.
Return Value
{
ListenableFuture
<List<Document>
>} A ListenableFuture resolved with a list of Documents.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
List<String> itemNames = new ArrayList<String>();
itemNames.add("EMail");
itemNames.add("Phone");
List<Document> responseDocs = client.deleteItems("Form = 'Contact' and LastName = 'Aardman'", itemNames).get();
deleteItemsByUnid
Deletes selected items in multiple documents.
Parameters
options
{Object
}
unids
{Array
<string
>} REQUIRED - An array of UNIDs.itemNames
{Array
<string
>} REQUIRED - An array of item namesaccessToken
{string
} An optional access token. See OptionalAccessToken for details.computeOptions
{Object
} An optional object specifying how to compute items on the specified documents. See Compute with form for details.onErrorOptions
{string
} A optional string specifying what to do when an error occurs. Must be either"ON_ERROR_CONTINUE"
or"ON_ERROR_ABORT_REMAINING"
.
Return Value
{
ListenableFuture
<List<Document>
>} A ListenableFuture resolved with a list of Documents.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
List<String> itemNames = new ArrayList<String>();
itemNames.add("EMail");
itemNames.add("Phone");
List<Document> responseDocs = client.deleteItemsByUnid(
Sets.newHashSet("28438659F50E2637852582C600038599",
"5B5544335FA7D893852582C60003859A"), itemNames).get();
deleteAttachments
Deletes attachments in documents matching a query string.
Parameters
options
{Object
}
query
{string
} REQUIRED -- A query string.accessToken
{string
} An optional access token. See OptionalAccessToken for details.queryArgs
{Array
<Object
>} An optional array of values to substitute in the query string. See Query arguments for details.queryLimits
{Object
} An optional set of limits on the query. See readDocuments for details.fileNames
{Array
<string
>} An optional array of attachment file names. If specified, only matching attachments are deleted. If not specified, ALL attachments are deleted.start
{number
} An optional zero-based document start index.count
{number
} An optional count of the maximum number of documents to process.onErrorOptions
{string
} A optional string specifying what to do when an error occurs. Must be either"ON_ERROR_CONTINUE"
or"ON_ERROR_ABORT_REMAINING"
.
Return Value
{
ListenableFuture
<List<AttachmentInfo>
>} A ListenableFuture resolved with a list of AttachmentInfo.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
OptionalFileNames files = new OptionalFileNames(Sets.newHashSet("photo.jpg"));
ListenableFuture<List<AttachmentInfo>> response =
client.deleteAttachments("Form = 'Contact' and LastName = 'Aardman'",files);
deleteAttachmentsByUnid
Deletes attachments in multiple documents.
Parameters
options
{Object
}
unids
{Array
<string
>} REQUIRED - An array of UNIDs.accessToken
{string
} An optional access token. See OptionalAccessToken for details.fileNames
{Array
<string
>} An optional array of attachment file names. If specified, only matching attachments are deleted. If not specified, ALL attachments are deleted.onErrorOptions
{string
} A optional string specifying what to do when an error occurs. Must be either"ON_ERROR_CONTINUE"
or"ON_ERROR_ABORT_REMAINING"
.
Return Value
{
ListenableFuture
<List<AttachmentInfo>
>} A ListenableFuture resolved with a list of AttachmentInfo.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
ListenableFuture<List<AttachmentInfo>> response =
client.deleteAttachmentsByUnid(
Sets.newHashSet("28438659F50E2637852582C600038599",
"5B5544335FA7D893852582C60003859A"));
replaceItems
Replaces selected items in all documents matching a query.
Parameters
options
{Object
}
query
{string
} REQUIRED - A query string.replaceItems
{Object
} REQUIRED - An object containing items to replace in all matching documents.accessToken
{string
} An optional access token. See OptionalAccessToken for details.queryArgs
{Array
<Object
>} An optional array of values to substitute in the query string. See Query arguments for details.queryLimits
{Object
} An optional set of limits on the query. See readDocuments for details.start
{number
} An optional zero-based document start index.count
{number
} An optional count of the maximum number of documents to process.computeOptions
{Object
} An optional object specifying how to compute items on the specified documents. See Compute with form for details.onErrorOptions
{string
} A optional string specifying what to do when an error occurs. Must be either"ON_ERROR_CONTINUE"
or"ON_ERROR_ABORT_REMAINING"
.duplicateItems
{boolean
} An optional boolean value used to create duplicate items in the matching documents. See Duplicate items for details.
Return Value
{
ListenableFuture
<List<Document>
>} A ListenableFuture resolved with a list of Documents.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
List<Item<?>> itemList = new ArrayList<Item<?>>();
itemList.add(new TextItem("City", "Chelmsford"));
itemList.add(new TextItem("State", "MA"));
List<Document> responseDocs = client.replaceItems("Form = 'Contact' and LastName = 'Aardman'", itemList).get();
replaceItemsByUnid
Replaces selected items in multiple documents by UNID.
Parameters
options
{Object
}
replaceItemsByUnid
{Array
<string
>} REQUIRED - An array of documentaccessToken
{string
} An optional access token. See OptionalAccessToken for details. objects. Each document object must include at least an@unid
property.replaceItems
{Object
} An optional object containing items to replace in all matching documents.computeOptions
{Object
} An optional object specifying how to compute items on the specified documents. See Compute with form for details.onErrorOptions
{string
} A optional string specifying what to do when an error occurs. Must be either"ON_ERROR_CONTINUE"
or"ON_ERROR_ABORT_REMAINING"
.duplicateItems
{boolean
} An optional boolean value used to create duplicate items in the matching documents. See Duplicate items for details.
Return Value
{
ListenableFuture
<List<Document>
>} A ListenableFuture resolved with a list of Documents.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
List<Item<?>> itemList1 = new ArrayList<Item<?>>();
itemList1.add(new TextItem("FirstName", "Aaron"));
itemList1.add(new TextItem("LastName", "Aardman"));
List<Item<?>> itemList2 = new ArrayList<Item<?>>();
itemList2.add(new TextItem("FirstName", "Brian"));
itemList2.add(new TextItem("LastName", "Zelnick"));
List<Item<?>> itemList = new ArrayList<Item<?>>();
itemList.add(new TextItem("City", "Chelmsford"));
itemList.add(new TextItem("State", "MA"));
Map<String, List<Item<?>>> replaceInfo = new HashMap<String, List<Item<?>>>();
replaceInfo.put("F0C617C4AF746BED852582B9006819F9", itemList1);
replaceInfo.put("3EB633978241DD02852582B9006819FE", itemList2);
List<Document> responseDocs = client.replaceItemsByUnid(replaceInfo, itemList).get();
replaceDocumentsByUnid
Replaces multiple documents.
Parameters
options
{Object
}
documents
{Array
<Object
>} REQUIRED - An array of documents to update. Each document object must include an@unid
property.accessToken
{string
} An optional access token. See OptionalAccessToken for details.computeOptions
{Object
} An optional object specifying how to compute items on the specified documents. See Compute with form for details.onErrorOptions
{string
} A optional string specifying what to do when an error occurs. Must be either"ON_ERROR_CONTINUE"
or"ON_ERROR_ABORT_REMAINING"
.duplicateItems
{boolean
} An optional boolean value used to create duplicate items in the matching documents. See Duplicate items for details.
Return Value
{
ListenableFuture
<List<Document>
>} A ListenableFuture resolved with a list of Documents.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
List<Item<?>> itemList1 = new ArrayList<Item<?>>();
itemList1.add(new TextItem("Form", "Contact"));
itemList1.add(new TextItem("FirstName", "Aaron"));
itemList1.add(new TextItem("LastName", "Aardman"));
itemList1.add(new TextItem("City", "Arlington"));
itemList1.add(new TextItem("State", "MA"));
List<Item<?>> itemList2 = new ArrayList<Item<?>>();
itemList2.add(new TextItem("Form", "Contact"));
itemList2.add(new TextItem("FirstName", "Brian"));
itemList2.add(new TextItem("LastName", "Zelnick"));
itemList2.add(new TextItem("City", "Andover"));
itemList2.add(new TextItem("State", "MA"));
Map<String, List<Item<?>>> replaceInfo = new HashMap<String, List<Item<?>>>();
replaceInfo.put("F0C617C4AF746BED852582B9006819F9", itemList1);
replaceInfo.put("3EB633978241DD02852582B9006819FE", itemList2);
List<Document> responseDocs = client.replaceDocumentsByUnid(replaceInfo).get();
explainQuery
Explains how a query string is processed.
Parameters
options
{Object
}
query
{string
} REQUIRED - A query string.accessToken
{string
} An optional access token. See OptionalAccessToken for details.queryArgs
{Array
<Object
>} An optional array of values to substitute in the query string. See Query arguments for details.queryLimits
{Object
} An optional set of limits on the query. See readDocuments for details.
Return Value
{
ListenableFuture
<string
>} A ListenableFuture resolved with explanation string
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
String responseDocs = client.explainQuery("Form = 'Contact' and LastName = 'Aardman'").get();
useAgent
A factory function for instantiating an Agent instance that is bound to a specific agent.
NOTE: This function does not make any requests to Domino for verification of the configuration.
Parameters
name
{string
} The Agent name or alias.
Return Value
An instance of the Agent class
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
List<Item<?>> itemList = new ArrayList<Item<?>>();
itemList.add(new TextItem("Form", "Contact"));
itemList.add(new TextItem("FirstName", "Jone"));
itemList.add(new TextItem("LastName", "Jonty"));
itemList.add(new TextItem("State", "MH"));
Document document = new Document(itemList);
ListenableFuture<Document> createResponse = client.createDocument(document);
Agent agent = client.useAgent("agent-with-selection-java");
String query = "Form = 'Contact' and State = 'MH'";
OptionalSelection optSelection = new OptionalSelection(query);
OptionalContext optContext = new OptionalContext(createResponse.get().getUnid());
ListenableFuture<AgentRunResponse> response = agent.run(optSelection, optContext);
The Java Agent class has only one run() method and it supports OptionalSelection and OptionalContext as optional arguments.
upsertDocument
UpsertDocument API Searches for a document matching a query string, then updates the selected items. If no document is found, creates a new document with the items instead.
Parameters
accessToken
{Object
} Optional - An optional access token. See OptionalAccessToken for details.query
{string
} REQUIRED - The query to search the document. The search query must find one document. If it finds multiple documents, upsertDocument fails with NOT_UNIQUE_SEARCH error.document
{document
} REQUIRED - The document object which will be used for upsert operation.queryArgs
{Array
<Object
>} Optional - An optional array of values to substitute in the query string. See Query arguments for details.queryLimits
{Object
} Optional - An optional set of limits on the query. See readDocuments for details.computeOptions
{Object
} Optional - An optional object specifying how to compute items on the specified documents. See Compute with form for details.
Return Value
{
ListenableFuture
<Document
>} A ListenableFuture resolved with a Document.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
Database client = server.useDatabase(TARGET_DATABASE);
List<Item<?>> itemList = new ArrayList<Item<?>>();
itemList.add(new TextItem("Form", "Contact"));
itemList.add(new TextItem("FirstName", "Aaron"));
itemList.add(new TextItem("LastName", "Aardman"));
itemList.add(new TextItem("City", "Arlington"));
itemList.add(new TextItem("State", "MA"));
String query = "Form = 'Contact' and FirstName = 'Aaron'";
ListenableFuture<Document> response = client.upsertDocument(query, new Document(itemList),
new ComputeOptions(true, false));