This article details the configuration and execution of Integration Server hook in OneData.
First, let’s take look at what is Hook? and different types of Hooks in OneData.
Hooks are commands that invoke external stored procedures. Hooks help the Administrative Users to extend OneData’s functionality.
Hooks can be broadly classified as:
- Standard hooks - Hooks that are invoked at a specific data manipulation event, and do not provide the option for interaction with a User.
- IHooks - Interactive hooks provide the capability for user interaction and are not invoked without receiving User input.
Hooks can be used as:
- pre hook
- post hook
- command hook
- workflow mapped hook
Pre hooks and Post hooks can generally be called as Event Driven Hooks. They are triggered based on a particular event (insert/update/delete/restore/purge). Pre hooks are triggered before the event and they are mainly used for data sanity checks/data consistency checks to ensure all business rules are taken into account.
Post hooks are called after the event and they are mainly used to run subsequent events in the same repository or any other repository.
Command hooks are specifically triggered based on certain records selected by the User from Data Manager or Workflow Items.
Workflow mapped hooks are triggered on a workflow action (approve/reject). iHooks that interact with OneData data management engine can be used as a workflow mapped hook.
Hooks can be written as:
- Stored procedure hook
- Java RMI hook
- Java local hook
- Process flow hook
- Integration Server hook
Stored procedure hook can be written as iHook/Standard hooks. Rest of the hook type’s support iHooks.
With the help of IS hooks, we can execute the UPDATE and DELETE operations on the OneData object as explained below.
1. Setting up the IS and OneData connection
1.Navigate In OneData Administer->System->Connection Manager
2.Select connection type as "Integration Server"
3.Specify the Connection name, Server, Port and Username and Password.
4.Save and Test connection to verify the connection is successful.
2. Configuring IS Hook in OneData
Prerequisites: Import the package to your Integration Server from SAG installer while installing OneData, you can get WmOneData.zip from ‘<Installation Directory>\OneData\IntegrationServer’
Steps to configure IS hook
1.Navigate In OneData Define->Configuration->Hooks
2. Click "Add Hook" Link
3.Specify the Hook name
4.Select hook type as "Integration Server" in * Hook Type combobox
5.Select the connection(IS connection name)
6.Specify the service folder to refer to the particular service in IS
Eg:pub.onedata.samples.Books and service in that folder is commandHook
7. Save and verify Hook is added successfully.
3. Create object and Table with the below columns
4. Steps to Associate Hook to Object
1.Navigate In OneData Define->Objects
2.Select the object that was created in previous step #3
3.Click Hooks tab ->Manage Hook Commands->Add Hook Command
4.Specify Command Name and Hook to be associated, and select the Role
Hook Command should be added successfully
5. Execution of command hook associated to OneData Object
1.Navigate In OneData Define->Objects ->select the object created in step #3
2.Insert the data in object by Navigating to Data Manager Link ->Apply filter->Insert Link
3. Specify the ID and ISBN number (9780198090472 ) Note: Google search for the ISBN number of the specific book.
4. Author and Title fields should be left blank as it is expected to be updated by the “update” command of associated IS hook.
5. Click on save link to Insert the record into a table
6.Navigate In OneData Define->Objects select -> “<object name>”->Go To Data Manager Link ->Apply filter
7. Select the data row that needs to be updated with the data.
Eg:Here the IS hook command is executed to get the info or Author and Title based on ISBN number
8.The below window is opened on clicking "Test Hook" link
9. Now click on Update link to update the data in the respective columns of the selected row.
Command executed successfully message should be seen with the data entered in the Author and Title column.
Similarly, Click on Delete link to delete the sleeted row
The row is deleted from the Table.