When information transmits between different domains, each domain might use different codes to define a same entity. For example, one domain use country code for representing country and other domain use original country name. In this case Domain Value Map is preferable. Domain Value Map is static in nature. DVM should be specified at the design time in jdeveloper and at the run time application will perform a look for the values in the DVM (Domain Value Map).
Description of Example
Here we will perform DVM operation using File adapters. SOA application will read the city code from one file and write the city name in the other file. Follow the below steps to see how to implement Domain Value Map in SOA application.
- Create an application for DVM implementation. Select File -> Application -> SOA Application. Enter application name DVMApplication
- Click on Next and Enter project name. Select Composite With Mediator as Composite type in the next wizard.
- Mediator creation window will open. Enter mediator name DVMMediator and select Define Interface Later as template type
- Now create file adapter in both lane Exposed Services and External References. Select File adapter from Technology component palate and drag and drop it in the Exposed Services lane
- Enter the service name and select the option Define from operation and schema(specified later)
- Click on Next and select Read File as operation type in the next wizard
- Navigate to next wizard and enter file directory where input file will be located an also enter the name pattern of the file. File adapter will process only the files which will be matched by the pattern.
- Click on Next and enter the polling frequency. Then define schema for file adapter in the next wizard by click on cog icon
- Enter schema file name and directory. Choose Delimited file type in the next wizard and file description also like below screenshot.
- Click on Next and select the options as shown in the below screenshot
- Schema is created
- Drag and drop a file adapter in the External References lane
- Select Write file as operation type for this file adapter
- Enter configuration property of file and select same schema which is create for input file earlier in this example.
- Now the composite will look like below screenshot
- Create Domain Value Map for city values. Right click on the project and select From Gallery -> SOA Tier -> Transformations/Translations -> Domain Value Map(DVM)
- DVM file creation window will open. Enter file name and initials DVM entries as per below screenshots.
- Create mapping in the mediator between exposed service and external reference. Click on transform icon to create mapper file
- Select dvm:lookup from Advanced XPath -> DVM Functions in the components palate and drag and drop it in the middle lane of the mapper file.
- Double click on the icon A�and enter dvmLocation, sourceColumnName, souirceValue, targetColumnName and defaultValue as per below screenshot
- Now mapper file will look like below screenshot
- Save the project. SOA Composite will look like this
- Deploy the project and test the project in EM Console. Keep the input file in the indir directory. Use the sample file for testing in the testing folder.
- Output file will be created in the ourdir that is specified during the configuration of file adapter
Note: If business user adds another domain value with same citycode, below error will come at the time of testing.
To overcome from this type of system error, qualifier will come into the picture. Refer this link for qualifier.