Setting schema for a Before Saving/Deleting Job - 7.3

Talend Data Fabric Studio User Guide

Version
7.3
Language
English (United States)
EnrichDitaval
Data Fabric
Product
Talend Data Fabric
Module
Talend Studio
Content
Design and Development

The Before Saving/Before Deleting processes are called directly by naming convention. They do not go through the usual Trigger > Process mechanism. Jobs called through a Before Saving or Before Deleting process receive a different document than when they are called through a Trigger. In addition, they are expected to return a status report or an error or warning (only for the Before Saving process) message which the Web Interface can use to proceed with / cancel the action.

Note: The process must always return a variable called output_report.

Input

The input document comprises the update report as well as the record which is being saved or deleted:

<exchange>
      <report>
      ... update report ...
      </report>
      <item>
      ... record ...
      </item>
</exchange>
Note: You can always find the exact schema description of an update report in the MDM Repository tree view in Data Model > System > UpdateReport.

In the Job, you may put conditions similar to triggers. For instance, you may use exchange/report/Update/OperationType to implement different conditions on CREATE and UPDATE.

Output

The Job is required to return a document that conforms to one of the following format according to the type of the message you want to display:

  • <report><message type="error">message</message></report>
  • <report><message type="warning">message</message></report>

    (only for the Before Saving process)

  • <report><message type="info">message</message></report>
Note: When you want to create a Before Saving process that both checks validation rules and completes the record on the fly, you must define a two-step process, with one step returning output_item and the other step returning output_report.

The working principles for the Before Saving and Before Deleting processes can be summarized as described in the following three cases.

Upon completion of the Before Saving or Before Deleting processes, the MDM server looks for a variable called output_report in the process pipeline.

First case:

  • If <report><message type="info">message</message></report>: the validation process of the data record has been carried out successfully and a message is displayed. The data record will be successfully saved with the Before Saving process, or successfully deleted with the Before Deleting process.

  • If <report><message type="warning">message</message></report> (only for the Before Saving process): the validation process of the data record has been carried out and a warning message is displayed. You can click either OK to continue the process and save the record or Cancel to abort the process.

  • If <report><message type="error">message</message></report>: the validation process of the data record fails and a message is displayed. The data record will not be saved with the Before Saving process, and it will not be deleted with the Before Deleting process.

Second case:

The MDM server has not found the output_report variable. The validation process of the data record has failed and an error message will be shown to confirm this. The data record will not be saved with the Before Saving process, and it will not be deleted with the Before Deleting process.

Third case:

The process throws an exception (typically one of the steps in the process leads to a technical error: wrong configuration, XSLT syntax error, Job not found or could not be called, and so on.). A technical error message will be displayed and the data record will not be saved with the Before Saving process, and it will not be deleted with the Before Deleting process.