4 Creating Client Scripts

This chapter discusses creating scripts for the client. Scripts provide hooks into client events.

User-written client scripts are executed when certain Capture client events are triggered. The framework defines a factory interface for script creation as well as an extension provider interface for extension configuration and invocation. This implementation of the extension provider allows for customization using JavaScript.

This chapter includes the following sections:

4.1 Client Events

This section defines client events.

  • BatchScanBegin

    Occurs when scanning into a batch is about to begin.

    public void BatchScanBegin(BatchScanEvent event);
    
  • BatchScanComplete

    Occurs when scanning into a batch is complete.

    public void BatchScanComplete(BatchScanEvent event);
    
  • BatchSelected

    Occurs when a batch has been selected.

    public void BatchSelect(BatchSelectedEvent event);
    
  • CaptureImage

    Occurs when an image is about to be captured from the scan source.

    public void CaptureImage(ImageCaptureEvent event); 
    
  • DBSearchComplete

    Occurs when the database search has completed, just before the results are to be processed.

    public void DBSearchComplete(DBSearchEvent event); 
    
  • DBSearchResults

    Occurs as database search results are being processed.

    public void DBSearchResults(DBSearchEvent event); 
    
  • DBSearchStart

    Occurs just before a database search.

    public void DBSearchStart(DBSearchEvent event); 
    
  • DocumentCreated

    Occurs after a document has been created.

    public void DocumentCreated(DocumentCreatedEvent event); 
    
  • DocumentRemoved

    Occurs after a document has been removed.

    public void DocumentRemoved(DocumentRemovedEvent event); 
    
  • DocumentSelected

    Occurs when a document has been selected.

    public void DocumentSelect(DocumentSelectedEvent event); 
    
  • FieldGotFocus

    Occurs when a metadata field receives the input focus.

    public void FieldGotFocus(FieldEvent event); 
    
  • FieldLostFocus

    Occurs when a field has lost the input focus.

    public void FieldLostFocus(FieldEvent event); 
    
  • FieldProcessKey

    Occurs when a key event happens while the focus is in a metadata field.

    public void FieldProcessKey(FieldEvent event);
    
  • PreBatchDelete

    Occurs when a batch is about to be deleted.

    public void PreBatchDelete(BatchDeleteEvent event); 
    
  • PreCaptureImage

    Occurs before an image has been captured from the scan source.

    public void PreCaptureImage(ImageCaptureEvent event); 
    
  • PreDownloadItem

    Occurs when a batch item is about to be downloaded.

    public void PreDownloadItem(DownloadItemEvent event); 
    
  • PreUploadItem

    Occurs when a batch item is about to be uploaded.

    public void PreUploadItem(UploadItemEvent event); 
    
  • PostCaptureImage

    Occurs after an image has been captured from the scan source.

    public void PostCaptureImage(ImageCaptureEvent event); 
    
  • PostDownloadItem

    Occurs after a batch item has been downloaded.

    public void PostDownloadItem(DownloadItemEvent event); 
    
  • PostUploadItem

    Occurs after a batch item has been uploaded.

    public void PostUploadItem(UploadItemEvent event); 
    
  • RegionSelected

    Occurs when a region has been selected on a document page.

    public void RegionSelected(RegionSelectedEvent event); 
    
  • ScriptStart

    Occurs when scripting is first initialized.

    public void ScriptStart();
    

4.2 Client Event Classes

This section defines client event classes.

Table 4-1 Client Event Classes

Class Description

oracle.oddc.clientextension.BatchDeleteEvent

List<CaptureBatch> batches - The list of batches that will be deleted.

boolean canceled - If this is set to True, the delete operation will be canceled.

oracle.oddc.clientextension.BatchScanEvent

CaptureBatch batch - The batch that new items will be added to during scan/import.

boolean canceled - If this is set to True, the scan/import will be canceled.

List<File> sourceFiles - When using the Import Source, this contains the list of files being imported.

CaptureOperation operation - Indicates the operation that triggered this event.

oracle.oddc.clientextension.BatchSelectedEvent

CaptureBatch batch - The batch that has been selected in the batch pane.

oracle.oddc.clientextension.DBSearchEvent

boolean displayHitlist - If set to True, displays the database lookup results.

boolean exactMatch - If set to True, the search value must be matched exactly.

String metadataID - The ID of the metadata field being searched.

String metadataValue - The value of the metadata field being searched.

List<DbSearchResultRow> rowResults - The list of row results returned from the search.

boolean canceled - If set to True, cancels the search.

oracle.oddc.clientextension.DocumentRemovedEvent

CaptureDocument document - The document being removed from the batch.

oracle.oddc.clientextension.DocumentCreatedEvent

CaptureDocument document - The document that has just been created.

oracle.oddc.clientextension.DocumentSelectedEvent

CaptureDocument document - The document that has been selected in the batch pane.

oracle.oddc.clientextension.DownloadItemEvent

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

oracle.fieldedit.FieldEvent

Traversal constants

  • static final int TRAVERSAL_UNDETERMINED = 0

  • static final int TRAVERSAL_FORWARD = 1

  • static final int TRAVERSAL_BACKWARD = 2

  • static final int TRAVERSAL_FORWARD_COMPONENT = 3

  • static final int TRAVERSAL_BACKWARD_COMPONENT = 4

Boolean cancel - If set to True, cancels the event.

DataField field - The field this event is acting upon.

KeyEvent keyEvent - The keyboard event used to generate this event.

int traversalDirection - Indicates which direction the field focus is moving (see Traversal constants).

ice.core.ImageCaptureEvent

boolean cancel - If this is set to True, the capture operation will be canceled.

Integer imageCount - Indicates how many images have been captured.

String imageFileName - Indicates the file name of image saved locally.

Integer xdpi - For images, indicates the horizontal dots per inch.

Integer ydpi - For images, indicates the vertical dots per inch.

Integer brightness - The brightness value used to capture the image.

Integer contrast - The contrast value used to capture the image.

boolean logicalBreak - If set to True, indicates the start of a document.

List<File> sourceFiles - When using the Import Source, contains the list of Files being imported.

String sourceFileName - When using the Import Source, contains the name of the source file being imported.

BufferedImage image - For images files, contains a BufferedImage object.

ImageCaptureEngine source - The ImageCapture Engine that created this event.

ImageCaptureEngine.ImageFormat imageFormat - Indicates the format that images will be saved as. Current values are: tiffG4, tiffJpegGray, tiffJpegColor, jpegGray, and jpegColor.

oracle.oddc.clientextension.RegionSelectedEvent

MouseEvent mouseEvent - The MouseEvent used to select the region within the image.

Rectangle selectionRectangle - The rectangle selected within the image.

BufferedImage image - The BufferedImage containing the selected portion of the image.

oracle.oddc.clientextension.UploadItemEvent

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


4.3 Capture Client Core Classes

This section defines Client Core Classes.

Table 4-2 Client Core Classes

Class Description

oracle.oddc.client.data.CaptureBatch

String batchId - The internal ID for the batch.

String batchName - The name of the batch.

String batchPath - The local path where information for this batch is stored.

String createdBy - The user that created the batch.

Date createdDate - The date that the batch was created.

Int currentPriority - The priority assigned to the batch.

CaptureBatchStatus currentStatus - The status assigned to the batch.

CaptureDocuments documents - The documents contained in the batch.

CaptureItems items - The items associated with the batch.

Date lastModifiedDate - The date that the batch was last modified.

String note - The note assigned to the batch.

CaptureWorkspace workspace - The workspace used to create the batch.

Method - void persist() throws BatchLockException, CaptureException - Saves the batch record to the server.

oracle.oddc.client.data.CaptureBatchStatus

Defines the batch status.

String value - The description of the status.

String id - The internal ID of the status.

oracle.oddc.client.data.CaptureDataType

An enumeration that defines the data types for metadata field definitions.

Values include: NUMERIC, ALPHA, ALPHANUMERIC, DATE, FLOAT

oracle.oddc.client.data.CaptureDocument

This class contains all properties of a document.

DocumentType documentType - The document profile assigned to the document.

CaptureFields fields - The metadata assigned to the document.

String id - The internal ID for the document.

CaptureDocumentPages pages - The pages contained in the document.

CaptureBatch parentBatch - The batch that contains this document.

String title - The title of the document.

Method - void persist() throws BatchLockException, CaptureException - Saves the document, related document pages, and metadata to the server.

oracle.oddc.client.data.CaptureDocumentPage

The class contains the properties of a document page.

String imageFilenameKey - The local filename for this page.

String pageID - The internal ID for the page.

int pageNumber - The number of the page within the document.

CaptureDocument parentDocument - The document that contains this page.

oracle.oddc.client.data.CaptureDocumentPages

This 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.

oracle.oddc.client.data.CaptureDocuments

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

oracle.oddc.client.CaptureErrorManager

This class manages what error messages are logged.

Level logLevel - The minimum level used to log messages.

Methods

  • void logMessage(Level level, String message) - Logs a message with the specified log level.

  • void logMessage(Level level, String message, Throwable errorException) - Logs a message and error with the specified log level.

oracle.oddc.client.data.CaptureField

Contains the properties of a document metadata field.

String displayValue - The value to display for this field.

String fieldname - The name of the field.

int length - The maximum length of the field.

boolean required - If True, this field is required to have a value.

String value - The value for this field.

oracle.oddc.client.data.CaptureFields

This 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.

oracle.oddc.client.data.CaptureItem

Contains properties of an item (single image or non-image file) associated with a document page.

String filename - The name of the file for this item.

CaptureBatch parentBatch - The batch containing this item.

String sourceFilename - If this item was imported, contains the name of the file it was imported from.

oracle.oddc.client.data.CaptureItems

This 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.

oracle.oddc.client.CaptureStateManager

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

CaptureBatch activeBatch - The active batch.

CaptureDocument activeDocument - The active document.

DocumentType activeDocumentType - The active document profile.

CaptureDocumentPage activePage - The active document page.

ClientProfile activeProfile - The active client profile.

String applicationUserPath - The path the client uses for its application data.

String batchesPath - The path the client uses to cache batch data.

String captureSystemId - The ID of the Capture system that the client is connected to.

String computerName - The name of the computer the client is running on.

String currentUser - The user currently logged into the client.

CaptureErrorManager errorManager - The Error Manager object used for logging information.

oracle.oddc.client.data.CaptureWorkspace

Contains all properties and operations for a workspace.

String id - The internal ID associated with the workspace.

FieldDefinitions fieldDefinitions - The metadata defined for this workspace.

String name - The name of the workspace.

List<CaptureBatchStatus> statuses - A list of batch statuses available to this workspace.

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

oracle.oddc.client.data.ClientProfile

Contains the properties of a client profile as defined in the Capture Workspace Console.

boolean alwaysDisplayHitList - If True, after a database lookup is executed, the results are displayed regardless of the number of results returned.

boolean applyBrightness - If True, applies the brightness and contrast settings to the selected Capture source.

int batchFilterDaysOldFrom - A batch filter setting that specifies the minimum days old a batch can be.

int batchFilterDaysOldTo - A batch filter setting that specifies the maximum days old a batch can be.

String batchFilterPrimarySortField - The batch property used for the primary sort of the batches tree.

SortOrder batchFilterPrimarySortOrder - The primary sort order for the batches tree.

String batchFilterSecondarySortField - The batch property used for the secondary sort of the batches tree.

SortOrder batchFilterSecondarySortOrder - The secondary sort order for the batches tree.

Integer batchFilterState - The batch states to include in the batch filter

String batchPrefix - The batch prefix to use for batches created using this profile.

String batchProcessorID - The ID of the batch processor to use during post-processing.

String batchProcessorJobID - The ID of the batch processor's job to use during post-processing.

BatchVisibility batchVisibility - A batch filter setting that specifies when a user will see the batch in the batches tree.

long blankByteThreshold - 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.

int brightness - The brightness to apply to the selected Capture source.

CaptureType captureType - Indicates whether the profile is capture-only, capture and index, or index-only.

int contrast - The contrast to apply to the selected Capture source.

int dbLookupMaxRecords - The maximum number of records to return from a database lookup.

String dbLookupProfileId - The ID of the database lookup profile used by this profile.

ColorType defaultColor - The default color type used during capture.

int defaultDpi - The default DPI to use during capture.

int defaultPriority - A batch created from this profile will be assigned this priority.

String defaultStatusId - A batch created from this profile will be assigned this status .

String description - The description for the profile.

oracle.oddc.client.data.ClientProfile

(Cont.)

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.

String id - The ID associated with this profile.

int maxPages - The non-image file preview page limit.

String name - The name of the profile.

NonImageAction nonImageAction - The action to take for non-image files.

String picklistRelationshipProfile - The dependent choice list used by this profile.

List<String> prefixes - The batch prefixes used in the batch filter.

boolean preventDefaultColorOverride - If True, the color cannot be overridden.

boolean preventDefaultDpiOverride - If True, the dpi cannot be overridden.

List<Integer> priorities - The batch priorities used in the batch filter.

int sepByteThreshold - 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.

List<String> statuses - The batch statuses used in the batch filter.

List<String> supportedDocumentTypes - A list of document profile IDs which represent the document profiles that this profile can assign to a batch.

String workspaceId - The ID of the workspace in which this profile is associated.

String workspaceName - The name of the workspace in which this profile is associated.

Enumeration Values

  • 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

oracle.oddc.client.data.DBLookupProfile

This class represents a profile for database lookup.

Sort constants

  • public static final Integer SORT_ASC = 0;

  • public static final Integer SORT_DESC = 1;

Methods

  • public DBLookupResult execDBLookup(String searchID, String fieldID, String value, boolean exactMatch) throws CaptureException - Executes a database lookup without sorting. Refer to the other execDBLookup method for parameter explanations.

  • public DBLookupResult execDBLookup(String searchID, String fieldID, String value, Boolean exactMatch, String primarySortField, Integer primarySortOrder, String secondarySortField, Integer secondarySortOrder) throws CaptureException - This executes a database lookup.

  • searchID - The ID of the database search defined for the database lookup profile.

  • fieldID - The ID of the metadata field being searched.

  • value - The value being searched upon.

  • exactMatch - If True, the value must match exactly.

  • primarySortField - The field ID used for the primary sort.

  • primarySortOrder - The sort order of the primary sort.

  • secondarySortField - The field ID used for the secondary sort.

  • secondarySortOrder - The sort order of the secondary sort.

oracle.oddc.client.data.DBLookupResult

The class represents the result of a database lookup.

List<DbSearchFieldInfo> searchFieldInfoList - A list of search field information describing the results returned by the database lookup.

List<DbSearchResultRow> searchResultRows - A list of search result rows returned by the database lookup.

oracle.oddc.session.DbSearchResultRow

This class represents one row result returned from a database lookup.

List<String> results - 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.

oracle.oddc.session.DbSearchFieldInfo

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

String captureIndexDefID - The metadata field ID.

String dbColumnName - The name of the database column.

Integer dbColumnType - The type of the database column.

Integer captureFieldType - The data type of the metadata field.

oracle.oddc.client.data.DocumentType

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

FieldDefinitions fieldDefinitions - The metadata applicable to the document profile.

String id - The internal ID associated with the document profile.

String name - The name for the document profile.

String description - The description for the document profile.

oracle.oddc.client.data.DocumentTypes

This class is a map of document profiles. It is of type TreeMap<String, DocumentType> and the map key is the document profile ID. Use the TreeMap methods to retrieve the document profiles from instances of this class.

oracle.oddc.client.data.FieldDefinition

This class represents a metadata field's definition.

ClientProfile.AutoPopulateType autoPopulateType - Specifies how the field should be auto-populated.

CaptureDataType dataType - The data type of this field.

String defaultValue - The default value for this field.

boolean displayable - Indicates whether this field will be displayed in the client.

int length - The maximum length for this field.

String id - The internal ID for this field.

String name - The name of this field.

String inputMask - The input mask.

boolean locked - True if the field is locked.

float maxValue - The maximum value for this field.

float minValue - The minimum value for this field.

boolean pickListCaseInsensitive - If True, the choice list is case insensitive.

String pickListID - The ID of the choice list associated with this field.

String pickListParentFieldID - The ID of the choice list parent field.

String pickListSourceID - The source ID of the dependent choice list for this field.

String profileDisplayFormat - The format used when displaying the field.

boolean required - Indicates whether this field is required to have a value.

String validationExpression - A regular expression used to validate the values entered for this field.

oracle.oddc.client.data.FieldDefinitions

This 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. Use the LinkedHashMap methods to retrieve the metadata field definitions from instances of this class.

oracle.oddc.client.batchbuilder.CaptureOperation

This is an enumeration that defines the capture operation being performed on the batch.

Values include: Create, Append, Insert, and Replace


4.4 Capture Client FieldEdit Classes

The FieldEdit class is the user interface component for entering metadata values.

Table 4-3 Client FieldEdit Classes

Class Description

oracle.fieldedit.field.DataField

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

String caption - The field caption.

String fieldname - The field name.

Format displayFormat - The display format for the field.

String inputMask - The input mask

boolean lock - If True, the field is locked.

long maxLength - The maximum length of the field.

boolean required - If True, this field is required to be entered.

String uncommittedText - The text current in the field.

oracle.fieldedit.field.DateField

This class extends from DataField and represents a date field.

Date value - The value, represented by a Date object.

oracle.fieldedit.field.FloatField

This class extends from DataField and represents a float field.

Float value - The value, represented by a Float object.

oracle.fieldedit.field.IntegerField

This class extends from DataField and represents an integer field.

Integer value - The value, represented by an Integer object.

oracle.fieldedit.field.PicklistField

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

boolean caseSensitive - If true, the contents of this list are sensitive to case.

List<PicklistEntry> pickListEntries - The list of entries in the choice list.

PicklistEntry value - The current value of the choice list.

oracle.fieldedit.field.TextField

This class extends from DataField and represents an alphanumeric field.

String value - The alphanumeric value of the field.

oracle.fieldedit.field.PicklistEntry

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

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