Package com.veeva.vault.sdk.api.edl
package com.veeva.vault.sdk.api.edl
This package provides interfaces to batch save and remove matched documents.
Overview
This service is used to batch save documents that are matched to specified EDL Item or remove manual matches from EDL Items.Example: Batch Save
The following example usesMatchedDocumentService to insert and update matched documents
to multiple EDL Items, with a combination of locking and unlocking document versions and including and excluding
matched documents.
MatchedDocumentService matchedDocumentService = ServiceLocator.locate(MatchedDocumentService.class);
// Provide only the document ID to match the latest version and unlock the document if its locked
SaveMatchedDocument includeDocument1 = matchedDocumentService.newSaveMatchedDocumentBuilder()
.withEdlItemId("0EI00000002001")
.withDocumentVersionId("1")
.excludeInTotal(false)
.build();
// Provide the full document version ID to match and lock to it if the version is valid and lockable
SaveMatchedDocument includeAndLockDocument2 = matchedDocumentService.newSaveMatchedDocumentBuilder()
.withEdlItemId("0EI00000002002")
.withDocumentVersionId("2_1_0")
.excludeInTotal(false)
.build();
// Exclude the match from the total count of matched documents
SaveMatchedDocument excludeAndUnlockDocument3 = matchedDocumentService.newSaveMatchedDocumentBuilder()
.withEdlItemId("0EI00000002001")
.withDocumentVersionId("3")
.excludeInTotal(true)
.build();
// Build the request
List<SaveMatchedDocument> documentList =
VaultCollections.asList(includeDocument1, includeAndLockDocument2, excludeAndUnlockDocument3);
BatchSaveMatchedDocumentsRequest request = matchedDocumentService.newBatchSaveMatchedDocumentsRequestBuilder()
.withMatchedDocuments(documentList)
.build();
// Run the request
List<MatchedDocumentSuccess> successes = new ArrayList<>();
List<MatchedDocumentError> errors = new ArrayList<>();
matchedDocumentService.batchSaveMatchedDocumentsRequest(request)
.onSuccesses(successes::addAll)
.onErrors(errors::addAll)
.execute();
Example: Batch Remove
The following example usesMatchedDocumentService to remove manually matched
documents from multiple EDL Items.
MatchedDocumentService matchedDocumentService = ServiceLocator.locate(MatchedDocumentService.class);
// Remove a document that is not locked on a specific version
RemoveMatchedDocument document1 = matchedDocumentService.newRemoveMatchedDocumentBuilder()
.withEdlItemId("0EI00000002001")
.withDocumentVersionId("1")
.build();
// Remove a document that is locked on a specific version
RemoveMatchedDocument document2 = matchedDocumentService.newRemoveMatchedDocumentBuilder()
.withEdlItemId("0EI00000002002")
.withDocumentVersionId("2_1_0")
.build();
// Build the request
List<SaveMatchedDocumentRequest> documentList = VaultCollections.asList(document1, document2);
BatchRemoveMatchedDocumentsRequest request = matchedDocumentService.newBatchRemoveMatchedDocumentsRequestBuilder()
.withMatchedDocuments(documentList)
.build();
// Run the request
List<MatchedDocumentSuccess> successes = new ArrayList<>();
List<MatchedDocumentError> errors = new ArrayList<>();
matchedDocumentService.batchRemoveMatchedDocumentsRequest(request)
.onSuccesses(successes::addAll)
.onErrors(errors::addAll)
.execute();
Best Practices & Gotchas
- Locked Documents: Using
MatchedDocumentServiceto match documents while specifying the full document version ID (e.g. "3_1_0") will lock the match to said document version. Similarly, removing the match will require the full document version ID to be specified. Specifying only the document id (e.g. "3") will unlock the document if it's locked, and will require only the document ID to remove the match. - Manually Matched Documents:
MatchedDocumentServicecan only remove manually matched documents.
-
ClassDescriptionContains the payload of one or more manually matched documents to remove from an EDL Item.Creates an instance of
BatchRemoveMatchedDocumentsRequest.Contains the payload of one or more matched documents to save to an EDL Item.Creates an instance ofBatchSaveMatchedDocumentsRequest.Represents an error that occurred while processing one provided matched document in the batch request.Provides data about the error included in aMatchedDocumentServicebatch operation response, including the error message and type.Valid values for error types when using methods inMatchedDocumentService.Contains information about one processed matched document, including the EDL Item ID and document version ID.Provides methods to batch save and remove automatically and manually matched documents.Custom batch operation response interface for theMatchedDocumentServicebatch methods.Represents the result of successfully processing one provided matched document in the batch request.Represents a manually matched document to remove from an EDL Item.Creates an instance ofRemoveMatchedDocument.Represents a matched document to save to an EDL Item.Creates an instance ofSaveMatchedDocument.