Using Record To Record Services
Record to Record Service takes inputs record by record and processes them according to the defined logic using java programming construct, and gives the output one record at a time. User can write Java logic that will be executed in this service. The Java logic has access to Record to Record script service, context of the process flow this service belongs to, input and output Stream handlers, which allow Java logic to access and manipulate input data to generate output and pass it to another service in the process flow.
Prerequisites
- Schema activity must be created before creating Record to Record Service.
Steps to create Record to Record activity
On the Adeptia Suite homepage, go to Develop > Services > Data Transformation > Record to Record.
The Manage Record to Record screen is displayed.
Manage Record to Record Service
Click the Create New link. The Create Record to Record screen is displayed.
Create Record to Record Service
- Enter the name and description of the new Record to Record service in the Name and Description fields respectively.
- Enter the sample Java script displayed in Figure 573 to perform the desired transformation.
Template Script:
Note: the complete script is executed for each record. // Setting Process Flow variable (nextRecord) value context.put("nextRecord","no"); // Setting one record into Process Flow Context context.put("RecordData",record); // Wait for Process Flow variable(nextRecord) value to be changed to 'yes' while(true) { try { String recordExist = (String)context.get("nextRecord"); if(recordExist.equalsIgnoreCase("no")) { Thread.sleep(1000); } else { break; } } catch (InterruptedException e) { e.printStackTrace(); } }
Sample Java Script
- Select input and output format as either XML or Native (non XML) from the Input Format and Output Format dropdown lists respectively.
Select the source schema activity from the Schema Name dropdown list.
If any XML Schema is selected in the Schema Name dropdown list, then the Input Format must be selected as XML.
To learn how to create Schema activity, refer to Creating Schema Activity section.
To learn about Advanced Properties refer to Changing Advanced Properties section.- Click the Save button.
12