Tuesday, 19 November 2013

Working with DVM in SOA 11g




       Hi, I want to Discuss About  Domain Value Maps(DVM) in Oracle SOA Suite 11G in this post

 Domain Value Maps(DVM)  They enable you to map from one vocabulary used in a given domain to another vocabulary used in a different domain. For example, one domain may represent a city with a long name (Mumbai), while another domain may represent a city with a short name (MB). In such cases, you can directly map the values by using domain value maps.

Domain value map values are static. You specify the domain value map values at design time using Oracle JDeveloper, and then at runtime, the domain value map columns are looked up for values.

Domain Value Map Features

Qualifier Support

Qualifiers qualify mappings. A mapping may not be valid unless qualified with additional information. For example, a domain value map containing a city code-to-city name mapping may have multiple mappings from KN to Kensington because Kensington is a city in both Canada and the USA. Therefore, this mapping requires a qualifier (USA or Canada) to qualify when the mapping becomes valid

Qualifier Support Example
Country (Qualifier) CityCode CityName
USA BO Boston
USA BELG_NC Belgrade
USA BELG_MN_Streams Belgrade
USA NP Northport
USA KN Kensington
Canada KN Kensington

Note: You can also specify multiple qualifiers for a domain value map
            Qualifier Order Support:- A qualifier order is used to find the best match during lookup at run time. Domain value maps support hierarchical lookup. If you specify a qualifier value during a lookup and no exact match is found, then the lookup mechanism tries to find a more generalized match by setting the higher order qualifiers to "". It proceeds until a match is found, or until a match is not found with all qualifiers set to "".
              One-to-Many Mapping Support:- You can map one value to a multiple values in a domain value map. For example, a domain value map for Payment Terms can contain mapping of payment terms to three values such as discount percentage, discount period, and total payment period.
Scenario:   
     In My example we use File Read and write Using DVM Logic 


   

In the above Example Mediater Mediating All Incoming files to File Write Location based on below XSD,

<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://www.example.org"
            targetNamespace="http://www.example.org"
            elementFormDefault="qualified">
  <xsd:element name="ListofOrder">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="Order" >
    <xsd:complexType>
    <xsd:sequence>
     <xsd:element name="OrderID" type="xsd:string" />
    <xsd:element name="basedata">
    <xsd:complexType>
    <xsd:sequence>
     <xsd:element name="CityCode" type="xsd:string" />
      <xsd:element name="CityName" type="xsd:string" />
       <xsd:element name="State" type="xsd:string" />
        <xsd:element name="Country" type="xsd:string" />
    
    </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="PricingData" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
     <xsd:element name="Freightamount" type="xsd:string" />
      <xsd:element name="PricingData" type="xsd:string" />
       <xsd:element name="Taxamount" type="xsd:string" />
    
    </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
Now i will Write file Data Based on DVM File.
Step 1: 
Create .DVM FILE using  Right click on project -> Select SOA-> Transformation-> Domain Value Map . Give some name to domain value map file and give some name to the domain fields then click OK.
Step 2: Define File Name and Description for the DVM file you created.  Enter the Domain Name and Domain Value      Enter the Doamin value to the particular domain name and click on OK 



Step 3: You can Create a Domain and Domain values as below



Step 4: While you creating a Domain prompts you below window

The Create Domain Popup window  is displayed 
Enter the Name in the Name field
Select the True if you want to column as a Qualifier
Select Qualifier Order field enter a qualifier number (If you want enabled this field then select as true in Qualifier field)
Click on OK (As discussed in
Domain Value Map Features)

Repeat same steps to create a Domain Country with Qualifier set to True


Step 4:  Create a Domain Value Map File as below



Step  5: Edit the transformation file in Mediater to add DVM

If you select the Advanced tab then you will get DVM Functions 
Now add lookupValue in the middle which element do you want lookup



Step 6:  When you double click on the DVM function Popup window will appear 

 In our case let us get CityName while we pass CityCode as inputs , only when  qualifiers matched




Specify values for the following fields in the Edit Function – lookupValue1M dialog:
  • In the dvmLocation field, enter the location URI of the domain value map file or click Browse to the right of the dvmLocation field to select a domain value map file. You can select an already deployed domain value map from the metadata service (MDS) and also from the shared location in MDS. This can be done by selecting the Resource Palette.
  • In the sourceColumnName field, enter the name of the domain value map column that is associated with the source element value, or click Browse to select a column name from the columns defined for the domain value map you previously selected.
  • In the sourceValue field, enter a value or press Ctrl-Space to use the XPath Building Assistant. Press the up and down arrow keys to locate an object in the list, and press Enter to select an item.
  • In the targetColumnName field, enter the name of the domain value map column that is associated with the target element value, or click Browse to select the name from the columns defined for the domain value map you previously selected.
  • In the QualifierCloumnName field,enter a value of the domain value map column that is associated with the qualifier  element value , or click Browse to select a column name from the columns defined for the domain value map you previously defied to be qualifier.
  •  In the QualifierValue nter a value or press Ctrl-Space to use the XPath Building Assistant. Press the up and down arrow keys to locate an object in the list, and press Enter to select an item.


Step 7:  Finally Transformation look like below.




For our Test case working with Qualifiers add 2 more fields to DVM file


So based on the value passed in state and country Citycode value is decided

if the test case contains state as AP, Country as India : DVMlookup gives you HYD_AP


Using DVM in Assign Activity


We can also achieve DVM function through Assign activity in BPEL



      Deploy our service ready to go with DVM

                                               

                                                                                                             By DeepthiReddy

No comments:

Post a Comment