Skip to main content

The upload and update workflow

JavaScript configuration

The upload and update workflow can be customized using standard attribute Initialization JavaScript Code. Learn more in upload workflow customization guidelines.

The update and upload workflow is used by the plug-in to monitor the process of uploading images and notify the end-user about the current progress and possible image issues. The workflow is used when the plug-in is configured to upload images on page submission using page item attribute Upload Image(s) on Request(s) or when the dynamic action Upload on Demand is triggered. The workflow includes steps described in the table below.

Workflow StepDescritption
Collect imagesThe plug-in scans a document for images and collects image meta-data
Downlaod imagesThe plug-in downloads not uplaoded images as base64 encoded images
Uplaod imagesThe plug-in uplaods base64 images using plug-in RESTful service
Update the plug-in session stateThe plug-in updates it's session state by updating a document content and updating images meta-data
Finalize the uploadThe plug-in last verification step before submitting a page (or exectuing dynamic action JavaScript callbacks)

Downloading and uploading images may raise issues which might be needed to be handled by the end-user before saving a document in the database. For example, downloading image from WEB may raise CORS policy violation, or uploading an image might be canceled due to the image upload validations. On the other hand, the application session can expire while end-user works with rich text document, and step updating the plug-in session state will raise PL/SQL error.

In order to have full control over the uploading and updating process, the plug-in exposes workflow steps configuration using JavaScript code to perform one of the following actions:

  • Continue - ignore issues (continue the workflow to the next step)
  • Cancel - cancel the workflow and don't submit a page (or execute JavasScript cancel callback)
  • Confirm - ask the end-user whether ignore issues (continue) or cancel the workflow

These actions can be executed by the workflow when:

  • download step raises at least one image issue
  • upload step raises at least one image issue
  • finalize the upload step recognizes at least one download or upload issue
learn more

When the workflow is canceled, the end-user can verify download and upload issues using the plug-in workflow summary (computed when downloading and uploading images). Once issues are fixed, the end-user can re-run the upload and update workflow.

Collect images

The plug-in scans a document for images and collects images meta-data. Not uploaded images (base64 images and images referenced by URL) are queued to download in download images step.

Download images

The plug-in iterates over images collected in collect images step and download them using the plug-in AJAX request. Downloaded images are embeded in a document as base64 images ready to be uploaded on upload images step.

It might happen that image hosted on external server can't be downloaded (ie. due to CORS policy), and if any image fails to download, the update & upload workflow can be configured to:

  1. Ignore download issues and continue
  2. Cancel the workflow automatically at the download images step
  3. Ask end-user what whether continue or cancel
Step configuration explained

The plug-in downloaded all images, or none image required downloading. The plug-in proceeds to the next step Upload image.

Upload images

The plug-in iterates over collected base64 images (including downloaded images), performs image validation and initializes the upload using AJAX POST request to RESTful upload handler using upload query parameters. An image upload validation checks if an image mime-type is allowed and if an image size doesn't exceeds maximum value. When an image is successfuly uploaded it's src property is replaced with URL returned from RESTful upload handler.

When any image validation fails, or uploading image using RESTful service raise an error, the update and upload workflow can be configured to:

  1. Ignore upload issues and continue
  2. Cancel the workflow at upload images step
  3. Ask end-user whether continue or cancel
Step configuration explained

The plug-in uploaded all images or there none image required uploading. The plug-in proceeds to the next step Update the plug-in session state.

Update the plug-in session state

At this point, images are downloaded and uploaded (issues might be ignored due to the plug-in configuration), the plug-in proceeds to update it's session state in the plug-in collection. This workflow step is divided into two sub-steps updating document draft CLOB, and updating image meta-data in the plug-in session state. If no issues are raised, and an application session doesn't expire, the plug-in proceeds to the next step Finalize the update and upload.

an application expired session

An application session may expire due to inactivity of the end-user, or when a new session for an application is created. Uploading images is not affected by the session expiration time because it's handled by RESTful service. Nevertheless, depending on how workflow was triggered (page submission or the plug-in dynamic action), the plug-in handles error differently.

Finalize

This step purpose is to let the end-user react to download or upload issues ignored in previous steps. Up until now, the plug-in did the following:

  • Downloaded images (or ignored download issues)
  • Uploaded images (or ignored upload issues)
  • Updated document in the plug-in session state
  • Updated images meta-data in the plug-in session state

This is the last moment, when the upload and update workflow can be canceled by the plug-in or on the end-user decision. This step can be configured to do the following:

  • Ignore all issues and submit page (or execute JavaScript done callback)
  • Cancel the workflow without reinitializing page submission (or execute JavaScript cancel callback)
  • Ask end-user whether ignore issues and continue submitting a page or cancel the workflow
Step configuration explained

If workflow was triggered by a page submission, the plug-in re-submits a page. If workflow was triggered by dynamic action, the JavaScript done callback is executed.