Validating a price change using the Before Saving process - 7.1

Talend Open Studio for MDM Getting Started Guide

author
Talend Documentation Team
EnrichVersion
7.1
EnrichProdName
Talend Open Studio for MDM
task
Data Governance > Modeling data
Design and Development
Installation and Upgrade
EnrichPlatform
Talend MDM Server
Talend MDM Web UI
Talend Studio

The idea of creating this example is to help you get familiar with the Talend MDM Before Saving process and show you how to use a Before Saving process to validate data changes in Talend MDM.

A process in Talend MDM defines one or multiple steps to perform business validation, data integration, data transformation, etc. A Before Saving process works with a specific entity and validates the entity data according to certain conditions before saving the data in the MDM Hub. It is automatically called back right before MDM saves the record. For more information about the process and the Before Saving process, see the section Processes in Talend Studio User Guide.

The Before Saving process beforeSaving_Product in Talend MDM demo project has been designed to validate any price change of a product before saving it in the MDM hub. This process uses the callJob plugin that calls the Job ValidatePriceChange created in the Integration perspective to validate the price change. For more information about how to create a callJob Before Saving process, see Setting up a callJob Process chain for a Before Process.

The Job ValidatePriceChange validates that the price does not increase or drop by more than 15%. When the price increases or drops by more than 15%, it will return an error message increase of/drop of [change ratio] not allowed, max is 15% that is defined in the tMap component with the label CheckRatio and the new price value will not be saved, or else, it will return an info message Product validation OK that is defined in the tMap component with the label SetResult and the new price will be successfully saved.

Before you begin

  1. The Talend MDM Server and Talend Studio have been successfully installed and started.
  2. The zip file TalendShop.zip has been downloaded and unzipped to the directory <tos_mdm_server_installation_directory>/resources/upload.
  3. The value of the context variable host and port in the Contexts view has been updated in the Integration perspective of Talend Studio if the MDM server is not installed locally and if you did not choose the default port number 8180 during the installation.
  4. At least the following Talend MDM demo project items, the Data Container Product, the Data Model Product, the Process beforeSaving_Product, the Job ValidatePriceChange, and the View Product in Talend Studio repository have been deployed to the MDM server.
  5. The Job MDM_LoadAll in Talend Studio has been executed successfully and the sample data has been loaded into the entity ProductFamily and Product.

For more information about the prerequisites, see Making the MDM demo project work.

About this task

You can perform the following steps to get more familiar with the Talend MDM demo project Before Saving process and execute it:

Procedure

  1. Log into Talend MDM Web UI with any of the MDM default users, either administrator/administrator or user/user.
  2. On the Master Data Browser page, open the product data record for which you want to change price. In this example, it is the product Talend Dog T-Shirt, whose price is 16.99.

    Example

  3. In the Price field on the data record page, enter a new price value for the product Talend Dog T-Shirt. In this example, it is 18 which will not increase the price by 15%.
  4. Click Save to save the change.
    An informational message Product validation OK will be displayed and you will find the price is successfully changed to 18.

    Example

  5. In the Price field on the data record page, enter another new price value for the product Talend Dog T-Shirt. In this example, it is 36 which will increase the price by 100%.
  6. Click Save.
    An error message dialog box, which shows you the price change is not allowed, will be displayed.

    Example

  7. Click OK to close the error message dialog box.
    You will find the new price 36 was not saved.