Showing posts with label Cross Reference - XREF. Show all posts
Showing posts with label Cross Reference - XREF. Show all posts

Friday, September 20, 2019

12c SOA XREF(Cross Reference)

Introduction:
  • Cross references are used to dynamically populate, maintain and map values for equivalent entities created by different applications.
  • This facility uses a database table – default name is XREF_DATA – that contains records per entity with the identity values in all domains. 
  • The definition of a cross reference is stored in a file, for example Employee.xref. The file contains the name of the cross reference as well as all the End Systems (identity domains) that are mapped.
  • This Xref file is exposed from the MDS, to be used across components and composite applications. 
  • In addition to all real identity domains, it is a good idea to add a ‘canonical’ domain that contains the common or generic identifier that is used to identify the entity in all canonical, domain independent, messages that flow through the service fabric.
Use Case:
Here I will show an example of an employee entity how the employee ids are mapped between two disparate applications Finance and Planning where both have different ids referring to the same employee entity.When an employee gets created in Finance application, the same entity will be created in planning application where Planning Employee Id will be generated concatenating the Finance EmpFId and EmpFirstName. Here I will also create a canonical field which will contain a common GuId which will help to map the FINANCE and PLANNING Ids.

From Finance application:
EmpFId
EmpFirstName
EmpLastName
EmpType
To Planning application:
EmpPId
EmpName
EmpFunction

Implementation:
Step1: Create a XREF Employee






 Create Above Table Structure In SOA-INFRA DB


Step2: MODE: ADD FINANCE Employee ID & LINK PLANNING Employee Id

Create a planning application id concatenating the FINANCE Employee id and First Name and assign to the planning application.

Create a GUIId variable and store guid using oraext:generate-guid() function which will be used as the value of canonical field.


Add the FINANCE Employee id with canonical value in the XREF.

xref:populateXRefRow('oramds:/apps/soa/xref/Employee.xref','FINANCE',$inputVariable.payload/ns1:EmpFId,'CANONICAL',$varGUIId,'ADD')

LINK the created PLANNING Id into the XREF for the respective FINANCE ID using the canonical id.
xref:populateXRefRow('oramds:/apps/soa/xref/Employee.xref','CANONICAL',$varGUIId,'PLANNING',$varEmpPId,'LINK')


Test:

You can see the FINANCE employee added and PLANNING Id LINKED to XREF table.

Step3: Fetch id from XREF(if required in the implementation).
Here fetching the FINANCE Id based on PLANNING Id 

xref:lookupXRef('oramds:/apps/soa/xref/Employee.xref','PLANNING',$varEmpPId,'FINANCE',true())


Depending upon the implementation, we can also update and delete the entries in the XREF dynamically.
Looking up - by using lookupXRef()
ADD/LINK/UPDATE - by using populateXRefRow()
Delete - by using markforDelete()

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...