3 Creating Client Scripts

This chapter describes the various events and classes that can be used to create scripts for Capture client.

Scripts provide hooks into client events. You can create a client script that gets executed when certain Capture client events are triggered. Capture enables you to create custom scripts to suit your business requirements.

Extensions allow you to customize client scripts. You can write and incorporate JavaScript extensions to extend Capture functionality. For more information on JavaScript extensions, see Oracle Fusion Middleware Managing Oracle WebCenter Enterprise Capture.

This chapter includes the following sections:

3.1 Client Events

Client scripts are JavaScript modules that enable you to customize the behavior of certain client events.

This section describes the following events:

3.1.1 BatchScanBegin

The BatchScanBegin event occurs when scanning into a batch is about to begin.

Syntax Parameter
public void BatchScanBegin(BatchScanEvent event); BatchScanEvent event

3.1.2 BatchScanComplete

The BatchScanComplete event occurs when scanning into a batch is complete.

Syntax Parameter
public void BatchScanComplete(BatchScanEvent event); BatchScanEvent event

3.1.3 BatchSelected

The BatchSelected event occurs when a batch has been selected.

Syntax Parameter
public void BatchSelected(BatchSelectedEvent event); BatchScanEvent event

3.1.4 CaptureImage

The CaptureImage event occurs when an image is about to be captured from the scan source.

Syntax Parameter
public void CaptureImage(ImageCaptureEvent event); ImageCaptureEvent event

3.1.5 DBSearchComplete

The DBSearchComplete event occurs when the database search has completed, just before the results are to be processed.

Syntax Parameter
public void DBSearchComplete(DBSearchEvent event); DBSearchEvent event

3.1.6 DBSearchResults

The DBSearchResults event occurs as database search results are being processed.

Syntax Parameter
public void DBSearchResults(DBSearchEvent event); DBSearchEvent event

3.1.7 DBSearchStart

The DBSearchStart event occurs just before a database search.

Syntax Parameter
public void DBSearchStart(DBSearchEvent event); DBSearchEvent event

3.1.8 DocumentCreated

The DocumentCreated event occurs after a document has been created.

Syntax Parameter
public void DocumentCreated(CaptureDocument document); CaptureDocument document

3.1.9 DocumentRemoved

The DocumentRemoved event occurs after a document has been removed.

Syntax Parameter
public void DocumentRemoved(DocumentRemovedEvent event); DocumentRemovedEvent event

3.1.10 DocumentSelected

The DocumentSelected event occurs when a document has been selected.

Syntax Parameter
public void DocumentSelected(DocumentSelectedEvent event); DocumentSelectedEvent event

3.1.11 FieldGotFocus

The FieldGotFocus event occurs when a metadata field receives the input focus.

Syntax Parameter
public void FieldGotFocus(FieldEvent event); FieldEvent event

3.1.12 FieldLostFocus

The FieldLostFocus event occurs when a field has lost the input focus.

Syntax Parameter
public void FieldLostFocus(FieldEvent event); FieldEvent event

3.1.13 FieldProcessKey

The FieldProcessKey event occurs when a key event happens while the focus is in a metadata field.

Syntax Parameter
public void FieldProcessKey(FieldEvent event); FieldEvent event

3.1.14 PreBatchDelete

The PreBatchDelete event occurs when a batch is about to be deleted.

Syntax Parameter
public void PreBatchDelete(BatchDeleteEvent event); BatchDeleteEvent event

3.1.15 PreCaptureImage

The PreCaptureImage event occurs before an image has been captured from the scan source.

Syntax Parameter
public void PreCaptureImage(ImageCaptureEvent event); ImageCaptureEvent event

3.1.16 PreDocumentRemove

The PreDocumentRemove event occurs when one or more documents are about to be deleted.

Syntax Parameter
public void PreDocumentRemove(PreDocumentRemoveEvent event); PreDocumentRemoveEvent event

3.1.17 PreDownloadItem

The PreDownloadItem event occurs when a batch item is about to be downloaded.

Syntax Parameter
public void PreDownloadItem(DownloadItemEvent event); DownloadItemEvent event

3.1.18 PrePageDelete

The PrePageDelete event occurs when one or more pages are about to be deleted.

Syntax Parameter
public void PrePageDelete(PageDeleteEvent event); PageDeleteEvent event

3.1.19 PreReleaseBatch

The PreReleaseBatch event occurs when a batch is about to be released.

Syntax Parameter
public void PreReleaseBatch(ReleaseBatchEvent event); ReleaseBatchEvent event

3.1.20 PreUploadItem

The PreUploadItem event occurs when a batch item is about to be uploaded.

Syntax Parameter
public void PreUploadItem(UploadItemEvent event); UploadItemEvent event

3.1.21 PostCaptureImage

The PostCaptureImage event occurs after an image has been captured from the scan source.

Syntax Parameter
public void PostCaptureImage(ImageCaptureEvent event); ImageCaptureEvent event

3.1.22 PostDownloadItem

The PostDownloadItem event occurs after a batch item has been downloaded.

Syntax Parameter
public void PostDownloadItem(DownloadItemEvent event); DownloadItemEvent event

3.1.23 PostUploadItem

The PostUploadItem event occurs after a batch item has been uploaded.

Syntax Parameter
public void PostUploadItem(UploadItemEvent event); UploadItemEvent event

3.1.24 RegionSelected

The RegionSelected event occurs when a region has been selected on a document page.

Syntax Parameter
public void RegionSelected(RegionSelectedEvent event); RegionSelectedEvent event

3.1.25 ScriptStart

The ScriptStart event occurs when scripting is first initialized.

Syntax
public void ScriptStart();

3.2 Event Classes

An event class is used to define an event. This section describes the following event classes:

3.2.1 BatchDeleteEvent

The BatchDeleteEvent class is used in events that occur when a user deletes a batch.

Property Type Description
batches List<CaptureBatch> List of batches that will be deleted.
canceled boolean If set to True, the delete operation will be canceled.

3.2.2 BatchScanEvent

The BatchScanEvent class is used in events that occur when a user scans a batch.

Property Type Description
batch CaptureBatch The batch that new items will be added to during scan or import.
canceled boolean If set to True, the scan or import will be canceled.
sourceFiles List<File> When using the Import Source, this contains the list of files being imported.
operation CaptureOperation Indicates the operation that triggered this event.

3.2.3 BatchSelectedEvent

The BatchSelectedEvent class is used in events that occur when a user selects a batch.

Property Type Description
batch CaptureBatch Batch that has been selected in the batch pane.

3.2.4 DBSearchEvent

The DBSearchEvent class is used in events that occur when a user initiates a database lookup.

Property Type Description
displayHitlist boolean If set to True, displays the database lookup results.
exactMatch boolean If set to True, the search value must be an exact match.
metadataID String ID of the metadata field being searched.
metadataValue String Value of the metadata field being searched.
rowResults List<DbSearchResultRow> List of row results returned from the search.
canceled boolean If set to True, cancels the search.

3.2.5 DocumentRemovedEvent

The DocumentRemovedEvent class is used in events that occur when a user removes a document from the batch.

Property Type Description
document CaptureDocument The document being removed from the batch.

3.2.6 DocumentSelectedEvent

The DocumentSelectedEvent class is used in events that occur when a user selects a document.

Property Type Description
document CaptureDocument The document that has been selected in the batch pane.

3.2.7 DownloadItemEvent

The DownloadItemEvent class is used in events that occur when batch items are downloaded from the server.

Property Type Description
captureItem CaptureItem After a batch is opened, indicates the current item being downloaded from the server.

3.2.8 FieldEvent

The FieldEvent class is used in events that occur when a user enters a field, exits a field, or types into a field.

Property Type Description
cancel Boolean If set to True, cancels the event.
field DataField The field this event is acting upon.
keyEvent KeyEvent The keyboard event used to generate this event.
traversalDirection Integer Indicates which direction the field focus is moving.

TRAVERSAL Constants:

  • TRAVERSAL_UNDETERMINED = 0

  • TRAVERSAL_FORWARD = 1

  • TRAVERSAL_BACKWARD = 2

  • TRAVERSAL_FORWARD_COMPONENT = 3

  • TRAVERSAL_BACKWARD_COMPONENT = 4


3.2.9 ImageCaptureEvent

The ImageCaptureEvent class is used in events that occur when the user is capturing an image.

Property Type Description
cancel boolean If set to True, the capture operation will be canceled.
imageCount Integer Indicates how many images have been captured.
imageFileName String Indicates the file name of image saved locally.
xdpi Integer For images, indicates the horizontal dots per inch.
ydpi Integer For images, indicates the vertical dots per inch.
brightness Integer The brightness value used to capture the image.
contrast Integer The contrast value used to capture the image.
logicalBreak boolean If set to True, indicates the start of a document.
sourceFiles List<File> When using the Import Source, contains the list of files being imported.
sourceFileName String When using the Import Source, contains the name of the source file being imported.
image BufferedImage For images files, contains a BufferedImage object.
source ImageCaptureEngine The ImageCaptureEngine that created this event.
imageFormat ImageCaptureEngine.ImageFormat Indicates the format that images will be saved as Available Formats: tiffG4, tiffJpegGray, tiffJpegColor, jpegGray, and jpegColor.

3.2.10 PageDeleteEvent

The PageDeleteEvent class is used when a page is being deleted.

Property Type Description
pages List<CaptureDocumentPage> The list of pages being deleted. You can modify this list to remove pages that you do not want to delete.
canceled Boolean If set to True, no pages will be deleted.

3.2.11 PreDocumentRemoveEvent

The PreDocumentRemoveEvent class is used when one or more documents are being deleted.

Property Type Description
selectedDocuments List<CaptureDocument> The list of selected documents about to be removed from the batch.
canceled Boolean If set to True, no documents will be deleted.

3.2.12 RegionSelectedEvent

The RegionSelectedEvent class is used in events that occur when a user selects a region of the image in the viewer.

Property Type Description
mouseEvent MouseEvent The MouseEvent used to select the region within the image.
selectionRectangle Rectangle The rectangle selected within the image.
image BufferedImage The BufferedImage containing the selected portion of the image.

3.2.13 ReleaseBatchEvent

The ReleaseBatchEvent class is used in events that occur when a batch is about to get released.

Property Type Description
batches List<CaptureBatch> The list of batches that are about to be released.
processorID String ID of the processor to which the batches will get released.
jobID String ID of the processor job.
canceled boolean If the flag is set to True, the release will be canceled.

3.2.14 UploadItemEvent

The UploadItemEvent class is used in events that occur when batch items are uploaded to the server.

Property Type Description
captureItem CaptureItem After a batch is released, indicates the current item being uploaded to the server.

3.3 Capture Client Core Classes

This section describes the following Capture Client Core classes:

3.3.1 CaptureBatch

The CaptureBatch class contains all properties and operations for a batch.

Property Type Description
batchId String The internal ID for the batch.
batchName String The name of the batch.
batchPath String The local path where information for this batch is stored.
createdBy String The user that created the batch.
createdDate Date The date that the batch was created.
currentPriority Integer The priority assigned to the batch.
currentStatus CaptureBatchStatus The status assigned to the batch.
documents CaptureDocuments The documents contained in the batch.
items CaptureItems The items associated with the batch.
jobID String ID of the processor job. This property is populated just before the batch is released.
lastModifiedDate Date The date that the batch was last modified.
note String The note assigned to the batch.
processorID String ID of the processor to which the batch will get released. This property is populated just before the batch is released.
workspace CaptureWorkspace The workspace used to create the batch.

The following table describes the syntax for persist() method:

Syntax Description
persist() throws BatchLockException, CaptureException Saves the batch record to the server.

3.3.2 CaptureBatchStatus

The CaptureBatchStatus class contains the properties of a batch status.

Property Type Description
value String The description of the status.
id String The internal ID of the status.

3.3.3 CaptureDataType

The CaptureDataType is an enumeration that defines the data types for metadata field definitions. The following are valid Capture data types:

  • NUMERIC

  • ALPHA

  • ALPHANUMERIC

  • DATE

  • FLOAT

3.3.4 CaptureDocument

The CaptureDocument class contains all properties of a document.

Property Type Description
documentType DocumentType The document profile assigned to the document.
fields CaptureFields The metadata assigned to the document.
id String The internal ID for the document.
pages CaptureDocumentPages The pages contained in the document.
parentBatch CaptureBatch The batch that contains this document.
title String The title of the document.

The following table describes the syntax for persist() method:

Syntax Description
persist() throws BatchLockException, CaptureException Saves the document, related document pages, and metadata to the server.

3.3.5 CaptureDocumentPage

The CaptureDocumentPage class contains the properties of a document page.

Property Type Description
imageFilenameKey String The local filename for this page.
pageID String The internal ID for the page.
pageNumber Integer The number of the page within the document.
parentDocument CaptureDocument The document that contains this page.

3.3.6 CaptureDocumentPages

The CaptureDocumentPages class is a collection of document pages and is of type Vector<CaptureDocumentPage>. Use the Vector methods to retrieve document pages from instances of this class.

See the Java API documentation for more information on the Vector class and its methods.

3.3.7 CaptureDocuments

The CaptureDocuments class is a collection of documents and is of type Vector<CaptureDocument>. Use the Vector methods to retrieve documents from instances of this class.

See the Java API documentation for more information on the Vector class and its methods.

3.3.8 CaptureErrorManager

The CaptureErrorManager class manages what error messages are logged.

Property Type Description
logLevel Level The minimum level used to log messages.

The following table describes the syntax for logMessage() method:

Syntax Description
logMessage(Level level, String message)

logMessage(Level level, String message, Throwable errorException)

Logs a message with the specified log level.

or

Logs a message and error with the specified log level.


The following table describes the parameters for logMessage() method:

Parameter Type Description
level Level The severity level for this log entry.
message String The message you wish to log.
errorException Throwable If logging an error, the exception that is the cause of the error.

3.3.9 CaptureField

The CaptureField class contains the properties of a document metadata field.

Property Type Description
displayValue String The value to display for this field.
fieldname String The name of the field.
length Integer The maximum length of the field.
required boolean If True, this field is required to have a value.
value String The value for this field.

The following table describes the syntax for setDate() method:

Syntax Description
setDate(Date date) Sets the value of the metadata field to a date.

The following table describes the parameters for setDate() method:

Parameter Type Description
date Date The date value to be set.

3.3.10 CaptureFields

The CaptureField class is a map of metadata field definitions. It is of type LinkedHashMap<String, CaptureField> and the map key is the field name. Use the LinkedHashMap methods to retrieve the fields from instances of this class.

See the Java API documentation for more information on the LinkedHashMap class and its methods.

3.3.11 CaptureItem

The CaptureItem class contains properties of an item (single image or non-image file) associated with a document page.

Property Type Description
filename String The name of the file for this item.
parentBatch CaptureBatch The batch containing this item.
sourceFilename String If this item was imported, contains the name of the file it was imported from.

3.3.12 CaptureItems

The CaptureItems class is a map of Capture items. It is of type TreeMap<String, CaptureItem> and the map key is the item filename. Use the TreeMap methods to retrieve the items from instances of this class.

See the Java API documentation for more information on the TreeMap class and its methods.

3.3.13 CaptureOperation

This is an enumeration that defines the capture operation being performed on the batch. The following are valid Capture operation values:

  • Create

  • Append

  • Insert

  • Replace

3.3.14 CaptureStateManager

The CaptureStateManager class contains properties related to the current state of the client. The instance of this class is available to all scripting events through the "Capture" property.

Property Type Description
activeBatch CaptureBatch The active batch.
activeDocument CaptureDocument The active document.
activeDocumentType DocumentType The active document profile.
activePage CaptureDocumentPage The active document page.
activeProfile ClientProfile The active client profile.
applicationUserPath String The path the client uses for its application data.
batchesPath String The path the client uses to cache batch data.
captureSystemId String The ID of the Capture system that the client is connected to.
computerName String The name of the computer the client is running on.
currentUser String The user currently logged into the client.
errorManager CaptureErrorManager The Error Manager object used for logging information.

3.3.15 CaptureWorkspace

The CaptureWorkspace class contains all properties and operations for a workspace.

Property Type Description
id String The internal ID associated with the workspace.
fieldDefinitions FieldDefinitions The metadata defined for this workspace.
name String The name of the workspace.
statuses List<CaptureBatchStatus> A list of batch statuses available to this workspace.

The following table describes the syntax for getDBLookupProfile() method:

Syntax Description
public DBLookupProfile getDBLookupProfile(String profileId) throws CaptureException Retrieves the database lookup profile for the given database lookup profile ID.

The following table describes the parameter for getDBLookupProfile() method:

Parameter Type Description
profileId String The ID of the database lookup profile.

3.3.16 ClientProfile

The ClientProfile class contains the properties of a client profile as defined in the Capture Workspace Console.

Property Type Description
alwaysDisplayHitList boolean If True, after a database lookup is executed, the results are displayed regardless of the number of results returned.
applyBrightness boolean If True, applies the brightness and contrast settings to the selected Capture source.
batchFilterDaysOldFrom Integer A batch filter setting that specifies the minimum days old a batch can be.
batchFilterDaysOldTo Integer A batch filter setting that specifies the maximum days old a batch can be.
batchFilterPrimarySortField String The batch property used for the primary sort of the batches tree.
batchFilterPrimarySortOrder SortOrder The primary sort order for the batches tree.
batchFilterSecondarySortField String The batch property used for the secondary sort of the batches tree.
batchFilterSecondarySortOrder SortOrder The secondary sort order for the batches tree.
batchFilterState Integer The batch states to include in the batch filter.
batchPrefix String The batch prefix to use for batches created using this profile.
batchProcessorID String The ID of the batch processor to use during post-processing.
batchProcessorJobID String The ID of the batch processor's job to use during post-processing.
batchVisibility BatchVisibility A batch filter setting that specifies when a user sees the batch in the batches tree.
blankByteThreshold long If the number of bytes in the file size of an image is less than the blankByteThreshold, the page is considered to be a blank page.
brightness Integer The brightness to apply to the selected Capture source.
captureType CaptureType Indicates whether the profile is capture-only, capture and index, or index-only.
contrast Integer The contrast to apply to the selected Capture source.
DBLookupMaxRecords Integer The maximum number of records to return from a database lookup.
DBLookupProfileId String The ID of the database lookup profile used by this profile.
defaultColor ColorType The default color type used during capture.
defaultDpi Integer The default DPI to use during capture.
defaultPriority Integer A batch created from this profile will be assigned this priority.
defaultStatusId String A batch created from this profile will be assigned this status.
description String The description for the profile.
documentCreationType DocumentCreationType Specifies how many pages are created per document at capture time.
documentTypes DocumentTypes An object containing the document profiles that this profile can assign to a batch.
id String The ID associated with this profile.
maxPages Integer The non-image file preview page limit.
name String The name of the profile.
nonImageAction NonImageAction The action to take for non-image files.
nonImageDpi int For client profiles having a nonImageAction property of type CONVERT, this property contains the image DPI for non-image files.
nonImageFormat String For client profiles having a nonImageAction property of type CONVERT, this property contains the image format for non-image files. This value will be either "TIFF_BW" or "JPEG".
nonImageJpegQuality int For client profiles having a nonImageAction property of type CONVERT and a nonImageFormat value of "JPEG", this property contains the JPEG image quality for non-image files.
picklistRelationshipProfile String The dependent choice list used by this profile.
prefixes List<String> The batch prefixes used in the batch filter.
preventDefaultColorOverride boolean If True, the color cannot be overridden.
preventDefaultDpiOverride boolean If True, the dpi cannot be overridden.
priorities List<Integer> The batch priorities used in the batch filter.
sepByteThreshold Integer If the number of bytes in the file size of an image is less than the sepByteThreshold, the page is considered to be a separator sheet.
statuses List<String> The batch statuses used in the batch filter.
supportedDocumentTypes List<String> A list of document profile IDs which represent the document profiles that this profile can assign to a batch.
workspaceId String The ID of the workspace in which this profile is associated.
workspaceName String The name of the workspace in which this profile is associated.

The following table describes the enumeration and values for the ClientProfile class:

Enumeration Value
AutoPopulateType NONE, SCANDATE, INDEXDATE, DEFAULTVALUE, BATCHNAME, USERID, COMPUTERNAME, CLIENTPROFILENAME, BATCHSTATUS, BATCHPRIORITY
BatchVisibility USER_AND_COMPUTER, USER, ALL
DocumentCreationType ONE_PAGE, TWO_PAGES, VARIABLE_PAGES, PROMPT_USER
CaptureType CAPTURE_ONLY, CAPTURE_AND_INDEX, INDEX_ONLY
NonImageAction DISALLOW, ALLOW, CONVERT
SortOrder ASCENDING, DESCENDING
ColorType NotSpecified, BlackAndWhite, Gray, Color

3.3.17 ClientUI

The ClientUI class allows the user to invoke user interface related actions and can be accessed through client scripts.

Property Type Description
batchEditForm BatchEditForm An instance of the current batch edit form.

This class includes the following methods:

releaseBatch()

The following table describes the syntax for releaseBatch() method:

Syntax Description
public void releaseBatch(List<CaptureBatch> batches, String processorID, String jobID) Unlocks or releases a list of batches for further processing.

The following table describes the parameters for releaseBatch() method:

Parameter Type Description
batches List<CaptureBatch> The list of batches to be released.
processorID String ID of the processor to which the batches will get released.
jobID String ID of the processor job.

setActiveMetadataFieldByName()

The following table describes the syntax for setActiveMetadataFieldByName() method:

Syntax Description
public void setActiveMetadataFieldByName(String fieldName) Moves the focus in the metadata pane to the metadata field specified by the field name.

The following table describes the parameter for setActiveMetadataFieldByName() method:

Parameter Type Description
fieldName String The name of the metadata field to which the focus is to be moved.

setActiveMetadataFieldByID()

The following table describes the syntax for setActiveMetadataFieldByID() method:

Syntax Description
public void setActiveMetadataFieldByID(String fieldID) Moves the focus in the metadata pane to the metadata field name specified by the field ID.

The following table describes the parameter for setActiveMetadataFieldByID() method:

Parameter Type Description
fieldID String The ID of the metadata field to which the focus is to be moved.

execDBSearch()

The following table describes the syntax for execDBSearch() method:

Syntax Description
public void execDBSearch(String metadataName, String metadataValue, Boolean alwaysDisplayHitList) Performs a database lookup for the given metadata field name and value. This method then updates the metadata fields in the metadata pane with the results.

The following table describes the parameters for execDBSearch() method:

Parameter Type Description
metadataName String The name of the metadata field that is to be looked up.
metadataValue String The value that is used to perform the lookup.
alwaysDisplayHitList Boolean If set to True, displays the lookup results irrespective of the number of results.

execDBSearch()

The following table describes the syntax for execDBSearch() method:

Syntax Description
public void execDBSearch(String metadataName, String metadataValue, Boolean alwaysDisplayHitList, Boolean exactSearch, Integer maximumRecords) Performs a database lookup for the given metadata field name and value. This method then updates the metadata fields in the metadata pane with the results.

The following table describes the parameters for execDBSearch() method:

Parameter Type Description
metadataName String The name of the metadata field that is to be looked up.
metadataValue String The value that is used to perform the lookup.
alwaysDisplayHitList Boolean If set to True, displays the lookup results irrespective of the number of results.
exactSearch Boolean If set to True, the result must exactly match the value being searched. If set to False, partial matches are also returned.
maximumRecords Integer Indicates the maximum number of records the search returns.

3.3.18 DBLookupProfile

The DBLookupProfile class represents a profile for database lookup. This class includes the following method:

execDBLookup()

The following table describes the syntax for execDBLookup() method:

Syntax Description
Database Lookup without sorting

DBLookupResult execDBLookup(String searchID, String fieldID, String value, boolean exactMatch, Integer maxRows) throws CaptureException

Database Lookup with sorting

DBLookupResult execDBLookup(String searchID, String fieldID, String value, Boolean exactMatch, String primarySortField, Integer primarySortOrder, String secondarySortField, Integer secondarySortOrder, Integer maxRows) throws CaptureException

Executes a database lookup with or without sorting.

Sort Constants:

  • SORT_ASC = 0

  • SORT_DESC = 1


The following table describes the parameters for the execDBLookup() method:

Parameter Type Description
searchID String The ID of the database search defined for the database lookup profile.
fieldID String The ID of the metadata field being searched.
value String The value being searched upon.
exactMatch Boolean If True, the value must be an exact match.
primarySortField String The field ID used for the primary sort.
primarySortOrder Integer The sort order of the primary sort.
secondarySortField String The field ID used for the secondary sort.
secondarySortOrder Integer The sort order of the secondary sort.
maxRows Integer The maximum number of rows to be returned.

3.3.19 DBLookupResult

The DBLookupResult class represents the result of a database lookup.

Property Type Description
searchFieldInfoList List<DbSearchFieldInfo> A list of search field information describing the results returned by the database lookup.
searchResultRows List<DbSearchResultRow> A list of search result rows returned by the database lookup.

3.3.20 DbSearchResultRow

The DbSearchResultRow class represents one row result returned from a database lookup.

Property Type Description
results List<String> A list of string values associated with one search result. The values in the list will be in the same order in which the return fields are defined.

3.3.21 DbSearchFieldInfo

The DbSearchFieldInfo class represents the field information describing the results of a database lookup.

Property Type Description
captureIndexDefID String The metadata field ID.
dbColumnName String The name of the database column.
dbColumnType Integer The type of the database column.
captureFieldType Integer The data type of the metadata field.

3.3.22 DocumentType

The DocumentType class represents a document profile. A document profile dictates what metadata fields are available to documents created from this type.

Property Type Description
fieldDefinitions FieldDefinitions The metadata applicable to the document profile.
id String The internal ID associated with the document profile.
name String The name for the document profile.
description String The description for the document profile.

3.3.23 DocumentTypes

The DocumentTypes class is a map of document profiles. It is of type TreeMap<String, DocumentType> and the map key is the document profile ID. You can use the TreeMap methods to retrieve the document profiles from instances of this class.

See the Java API documentation for more information on the TreeMap class and its methods.

3.3.24 FieldDefinition

The FieldDefinition class represents a metadata field's definition.

Property Type Description
autoPopulateType ClientProfile.AutoPopulateType Specifies how the field should be auto-populated.
dataType CaptureDataType The data type of this field.
autoPopulateDefault String The default value for this field.
displayable boolean Indicates whether this field will be displayed in the client.
length Integer The maximum length for this field.
id String The internal ID for this field.
name String The name of this field.
inputMask String The input mask.
locked boolean True if the field is locked.
maxValue Float The maximum value for this field.
minValue Float The minimum value for this field.
pickListCaseInsensitive boolean If True, the choice list is case insensitive.
pickListID String The ID of the choice list associated with this field.
pickListParentFieldID String The ID of the choice list parent field.
pickListSourceID String The source ID of the dependent choice list for this field.
profileDisplayFormat String The format used when displaying the field.
required boolean Indicates whether this field is required to have a value.
validationExpression String A regular expression used to validate the values entered for this field.

3.3.25 FieldDefinitions

The FieldDefinitions class is a map of metadata field definitions. It is of type LinkedHashMap<String, FieldDefinition> and the map key is the metadata field definition ID. You can use the LinkedHashMap methods to retrieve the metadata field definitions from instances of this class.

See the Java API documentation for more information on the LinkedHashMap class and its methods.

3.4 Capture Client FieldEdit Classes

The FieldEdit class is the user interface component for entering metadata values. This section describes the following Capture Client FieldEdit classes:

3.4.1 DataField

The DataField class represents the data for a single field of the FieldEdit component and is the base class for the various field types.

Property Type Description
caption String The field caption.
fieldName String The field name.
displayFormat Format The display format for the field.
inputMask String The input mask.
fieldLock boolean If True, the field is locked.
maxLength Long The maximum length of the field.
required boolean If True, this field is required to be entered.
uncommittedText String The current text in the field.

3.4.2 DateField

The DataField class extends from DataField and represents a date field.

Property Type Description
value Date The value, represented by a Date object.

3.4.3 FloatField

This FloatField class extends from DataField and represents a float field.

Property Type Description
value Float The value, represented by a Float object.

3.4.4 IntegerField

The IntegerField class extends from DataField and represents an integer field.

Property Type Description
value Integer The value, represented by an Integer object.

3.4.5 PicklistEntry

The PicklistEntry class is used in picklist-type fields to determine the display and commit values. This class includes the following methods:

getCommitValue()

The following table describes the syntax for getCommitValue() method:

Syntax Description
public String getCommitValue() Returns the commit value of the choice list entry.

getDisplayValue()

The following table describes the syntax for getDisplayValue() method:

Syntax Description
public String getDisplayValue() Returns the display value of the choice list entry.

3.4.6 PicklistField

The PicklistField class extends from DataField and represents a Pick-list (Choice List) field.

Property Type Description
pickListCaseSensitive boolean If true, the contents of this list are sensitive to case.
pickListEntries List<PicklistEntry> The list of entries in the choice list.
value PicklistEntry The current value of the choice list.

3.4.7 TextField

This TextField class extends from DataField and represents an alphanumeric field.

Property Type Description
value String The alphanumeric value of the field.

3.5 Sample Client Scripts

The section describes the following sample client scripts:

3.5.1 Sample Client Script 1

This sample script customizes client behavior in the following ways:

  • Prevents the client user from leaving a metadata field if the entry contains the word "test".

  • Prevents the user from entering an asterisk in any metadata field.

  • Outputs event information to the java console, such as coordinates after a user right-mouse-drags a selection on an image.

  • Stops releasing the batches to predefined processors and unlocks the batches.

Note that this script also writes out a line (printIn) to the java console for each script event, for verification or debugging purposes.

importClass(java.awt.event.KeyEvent);
 
function ScriptStart() {
    println("ScriptStart");
}
 
function BatchScanBegin(event) { // BatchScanEvent
    println("BatchScanBegin");
}
 
function BatchScanComplete(event) { // BatchScanEvent
    println("BatchScanComplete");
    println(event.getBatch().getBatchName() + " finished Scanning.");
}
 
function BatchSelected(event) { // BatchSelectedEvent
    println("BatchSelected: " + event.getBatch().getBatchName());
}
 
function PreBatchDelete(event) { // BatchDeleteEvent
    println("BatchDelete");
}
 
function CaptureImage(event) { // ImageCaptureEvent
    println("CaptureImage");
}
 
function DocumentCreated(event) { // CaptureDocument
    println("DocumentCreated");
}
 
function DocumentSelected(event) { // DocumentSelectedEvent
    println("DocumentSelected: " + event.getDocument().getTitle());
}
 
function FieldGotFocus(event) { // FieldEvent
    println("FieldGotFocus");
}
 
function FieldLostFocus(event) { // FieldEvent
    var dataField;
    println("FieldLostFocus");
    dataField = event.getField();
    if (dataField.getUncommittedText().equalsIgnoreCase("test")) {
        event.setCancel(true);
        println("invalid value. script will not allow leaving focus.");
    }
}
 
function FieldProcessKey(event) { // FieldEvent
    var keyEvent;
    // println("FieldProcessKey");
    keyEvent = event.getKeyEvent();
    if (keyEvent.getID() == KeyEvent.KEY_TYPED) {
        //println(keyEvent.getKeyChar());
        if (String.fromCharCode(keyEvent.getKeyChar()) == '*') {
            println("Asterisk not allowed in any field.");
            keyEvent.consume();
        }
    }
}
 
function PostCaptureImage(event) { // ImageCaptureEvent
    println("PostCaptureImage");
}
 
function PreCaptureImage(event) { // ImageCaptureEvent
    println("PreCaptureImage");
}
 
 
function PreUploadItem(event) { // UploadItemEvent
    println("PreUploadItem: " + event.getCaptureItem().getFilename());
}
 
function PostUploadItem(event) { // UploadItemEvent
    println("PostUploadItem: " + event.getCaptureItem().getFilename());
}
    
function DBSearchComplete(searchEvent) { // DBSearchEvent
    println("DBSearchComplete.");
}
 
function DBSearchResults(searchEvent) { // DBSearchEvent
    var results;
    var resultRow;
    var searchParameters;
 
    println("DBSearchResult");
 
    results = searchEvent.getRowResults();
    println("Found " + results.size() + " results.");
}
 
function DBSearchStart(searchEvent) {  // DBSearchEvent
    println("DBSearchStart");
    println("Metadata value was " + searchEvent.getMetadataValue());
    //searchEvent.setMetadataValue("c");
}
 
function DocumentRemoved(event) { // DocumentRemovedEvent
    println("DocumentRemoved");
}
 
function ImportFilesSelected(files, cancel) { // ImportFilesSelectedEvent
    println("ImportFilesSelected");
}
 
function PostDownloadItem(event) { // DownloadItemEvent
    println("PostDownloadItem: " + event.getCaptureItem().getFilename());
}
 
function PreDownloadItem(event) { // DownloadItemEvent
    println("PreDownloadItem: " + event.getCaptureItem().getFilename());
}
 
function RegionSelected(event) { // RegionSelectedEvent
    var rect;
    println("RegionSelected");
    rect = event.getSelectionRectangle();
    println("Rectangle (X,Y): (" + rect.getX() + "," + rect.getY() + "); (W,H): (" + rect.getWidth() + "," + rect.getHeight() + ")");
}
 
function PreReleaseBatch(event) { // ReleaseBatchEvent
    // Clears the postProcess setting specified in the Capture profile and allows the batches to get unlocked.
    event.setProcessorID(null);
    event.setJobID(null);
}

3.5.2 Sample Client Script 2

This sample script customizes client behavior in the following ways:

  • Uses the BatchScanBegin function to restrict files that can be imported to those with a .TIF extension only.

  • Uses the DBSearchResults function to modify the results of a database lookup so that only the first result is used, and prevents the results list from displaying.

importClass(java.util.ArrayList);

function BatchScanBegin(event) { // BatchScanEvent
    // Check if there are files being imported.
    var sourceFilesList = event.getSourceFiles();
    if (sourceFilesList != null) {
        // Create a list to hold the filtered results.
        var filteredList = new ArrayList();
        
        // Loop through each of the files.
        var iterator = sourceFilesList.iterator();
        while (iterator.hasNext()) {
            // If the file name ends with ".TIF", add it to the list.
            var file = iterator.next();
            var filename = file.getName().toUpperCase();
            if (filename.endsWith(".TIF")) {
                filteredList.add(file);
            }
        }
        
        // Replace the original list with the filtered list.
        event.setSourceFiles(filteredList);
    }
}
 
function DBSearchResults(searchEvent) { // DBSearchEvent
    var results;
    var resultRow;
    var searchParameters;
 
    // Return only the first search result.
    results = searchEvent.getRowResults();
    if (results.size() > 0) {
        resultRow = results.get(0);
        results.clear();
        results.add(resultRow);
        // Do not display the list of results to the user.
        searchEvent.setDisplayHitlist(false);
    }
}