Document Handling
Default table
By default, APEX Office Edit uses the default table AOE_DEFAULT_FILES
to store documents. The default table uses the sequence AOE_DEFAULT_FILES_SEQ
and triggers BI_AOE_DEFAULT_FILES
. The default table, trigger, and sequence are created with the sample application and the plug-in DDL installation script.
Column Name | Data Type | Nullable | Primary Key | Description |
---|---|---|---|---|
ID | NUMBER | Column is used to uniquely identify a document | ||
CONTENT | BLOB | Column is used to store a document contents | ||
FILENAME | VARCHAR2(4000) | Column is used to store a document filename | ||
MIME_TYPE | VARCHAR2(4000) | Column is used to store a document MIME-type | ||
BLOB_OWNER | VARCHAR2(4000) | Column is used to store a document owner name | ||
VERSION | NUMBER | Column is used to store a document current version | ||
LAST_UPDATE_DATE | TIMESTAMP(6) | Column is used to store a document last modification time | ||
CREATE_BY | VARCHAR2(255) | Audit field containing APEX username that created a file | ||
CREATE_DATE | DATE | Audit field containing DATE value when a file was created | ||
UPDATE_BY | VARCHAR2(255) | Audit field containing APEX username that modified a file | ||
UPDATE_DATE | DATE | Audit field containing DATE value when a file was modified |
Flows
Creating, loading, updating, saving as a new file and renaming documents are the result of communication between the AOE host server and the plug-in Oracle RESTful service module APEX Office Edit. If the RESTful handler request is interrupted by PL/SQL error, the plug-in shows a user-friendly error to the end user. Learn more about error handling in RESTful service \ Error Handling.
Assumptions:
- the flows described below are illustrative and should be considered as-is
- the flows don't include a flow path when the RESTful service handler raises an error
- flows below describe when the Source attribute is set to
Default Table
.
Loading documents
-
The end-user initializes loading a document by the sequence of events in an application using APEX Office Edit:
-
a page item defined in the Item Containing Primary Key(s) Value(s) attribute is set with a document id
-
the AOE is refreshed
-
an AOE access token is generated containing information about the requested document and the configuration
-
AOE submits the form and sends the information to the AOE server.
-
-
The AOE server handles the form submission and initializes a request to the RESTful service to fetch document meta-data
- The Get a document information RESTful service handler
-
evaluates the configuration delivered through the access token (access token validity, end-user permissions, region read-only mode, and others)
-
fetches document meta-data
-
returns document meta-data and AOE editor features
-
- The Get a document information RESTful service handler
-
The AOE server interprets the returned document meta-data and initializes a request to the RESTful service requesting document contents
-
The RESTful service handler fetches the document contents as a
BLOB
-
The RESTful service handler executes a PL/SQL read callback (if defined)
-
The REST service handler returns the document's contents
-
-
The AOE server renders the AOE editor with the loaded document as the contents of the iframe
-
The plug-in requests the RESTful service to get the document meta-data
-
Once the editor is fully loaded, the AOE Document loaded event is triggered
Creating a new document
-
The end-user initializes the creation of a new document by clicking on the desired document type tile in the new file panel
-
The widget requests the REST Service handler Create a new document to create a new document
-
The RESTful service handler:
-
evaluates the configuration delivered through the access token (access token validity, end-user permissions, region read-only mode, and others)
-
checks if the default filename is already taken. If yes, it assigns a new filename using the first available number in brackets. For example, the default filename is New file, but the filename is already taken, so a new document filename is New file (1)
-
inserts blank document contents into
AOE_DEFAULT_FILES
-
inserts the first (empty) version of a document into
AOE_DEFAULT_VERSIONS
(if the plug-in flagg_default_versioning
is set totrue
) -
(if defined) executes PL/SQL insert callback
-
returns document meta-data (a new document ID, filename, a document owner, last modification time)
-
-
The plug-in evaluates the response and
- sets a new document ID as the value of a page item defined in the Item Containing Primary Key(s) Value(s) attribute
- refreshes the AOE region
-
Go to flow Loading documents
Saving document contents
-
The end-user clicks the Save button in the AOE editor toolbar (or click the menu position File \ Save or presses the key shortcut
CTRL+S
)-
The widget initializes a save action
-
The AOE Before Update event is triggered
-
-
The AOE server reacts to the save action and starts a request to the RESTful service handler Update a document's contents
-
The RESTful service handler:
-
evaluates the configuration delivered through the access token (access token validity)
-
updates the document contents in the table
AOE_DEFAULT_FILES
-
inserts a new version of a document into
AOE_DEFAULT_VERSIONS
(if the flagg_default_versioning
is set totrue
) -
(if defined) executes PL/SQL update callback
-
returns document last modification time
-
-
The AOE server interprets the request result and notifies the widget about the successful action result
-
The AOE editor requests the RESTful service for a document meta-data
-
The AOE After Update event is triggered
Saving a document as a new document with a new filename
-
The end-user clicks the Save As button (menu position File \ Save As)
-
AOE shows a dialog with a form to save a document with a new filename
-
The end-user provides a new filename
-
the end-user clicks the dialog Save as button
-
the AOE server is notified about the save as action
-
The AOE Before Save As event is triggered
-
-
The AOE server reacts to the save as action and starts a request to the RESTful Service handler Save a document as a copy with a new filename
-
The REST service handler:
-
evaluates the configuration delivered through the access token (access token validity)
-
checks if the filename is already taken. If yes, it assigns a new filename using the first available number in brackets.
-
inserts an updated document with a new filename into the table
AOE_DEFAULT_FILES
-
inserts the first version of a document into
AOE_DEFAULT_VERSIONS
(if the plug-in flagg_default_versioning
is set totrue
) -
(if defined) executes PL/SQL save as callback
-
generates and returns a new access token for a new document along with document meta-data
-
-
The AOE Server interprets the results and notifies the AOE Editor widget that a document was successfully saved as a new file with a new filename
-
The AOE Server notifies the AOE editor widget that a document was reloaded
-
The AOE editor requests the RESTful service for document meta-data
-
The AOE After Save As event is triggered
Renaming a document
- The end-user updates the filename in the AOE editor toolbar and presses
ENTER
key. - The AOE Host Server starts the renaming action and requests the RESTful service handler Rename a document
- The REST service handler:
- evaluates the configuration delivered through the access token (access token validity)
- renames a document in the table
AOE_DEFAULT_FILES
- inserts the first version of a document into
AOE_DEFAULT_VERSIONS
(if the plug-in flagg_default_versioning
is set totrue
) - (if defined) executes PL/SQL rename callback
- generates and returns a new access token for a new document along with document meta-data
- The AOE server interprets the results and notifies the AOE editor widget that a document was successfully renamed
- The AOE editor requests the RESTful service for document meta-data
- The AOE After Rename event is triggered