Menu

Tuesday, July 17, 2012

How To Create Integration Object Instances Programmatically

Integration objects are metadata structures that represent hierarchical objects using components and fields.

Siebel integration objects allow you to represent integration metadata for Siebel business objects, XML, SAP IDOCs, and SAP BAPIs as common structures that the EAI infrastructure can understand. Because these integration objects adhere to a set of structural conventions, they can be traversed and transformed programmatically, using Siebel eScript objects, methods, and functions, or transformed declaratively using Siebel Data Mapper

For easy of demonstration the standard "EAI Account" integration object will be used.

To create the correct integration object (IO) instance programmatically, it is required that the following rules are followed:
1) The root property set must have its type set to "ListOf" concatenated to the IO name. (ListOfIOName)

2) The next property set of the hierarchy must have the root integration component (IC) name as its type. The root IC is the one that has no Parent Integration Component set. (RootICName)

3) All other IC's have the Parent Integration Component set. For those ICs you should always create a property set with type set to "ListOf" concatenated with the IC name and then add as child to this property set another one with type set to the IC name. Below is a sample structure to exemplify the idea.

ListOfICName
    ICName

This hierarchy must be created below the corresponding parent IC.

4) Repeat step 3 to all ICs that you want on the IO instance.

Below you will find an example of a general property set structure.

ListOfIOName
    RootICName
        ListOfICName1
            ICName1
                ListOfICName1_1
                    ICName1_1
        ListOfICName2
            ICName2

Example


For easy of demonstration we are going to use the EAI Account integration object with only some of its integration components.



Based on its hierarchy shown above, the integration object instance will have the property set hierarchy below:

ListOfEAI Account
    Account
        ListOfAccount_Business Address
            Account_Business Address
        ListOfContact
            Contact
                ListOfContact_Alternate Phone
                    Contact_Alternate Phone

The sample code below creates the above hierarchy.

...
1   // local variables & error handling are omitted for clarity
2   psConAltPhone.SetType("Contact_Alternate Phone");
3   psConAltPhone.SetProperty("Alternate Phone #", "555-5555");
4
5   psListOfConAltPhone.SetType("ListOfContact_Alternate Phone");
6   psListOfConAltPhone.AddChild(psConAltPhone);
7
8   psContact.SetType("Contact");
9   psContact.SetProperty("First Name", "John");
10  psContact.SetProperty("Last Name", "Smith");
11  psContact.AddChild(psListOfConAltPhone);
12
13  psListOfContact.SetType("ListOfContact");
14  psListOfContact.AddChild(psContact);
15
16  psAccBusAdd.SetType("Account_Business Address");
17  psAccBusAdd.SetProperty("Email Address", "john.smith@email.com");
18
19  psListOfAccBusAdd.SetType("ListOfAccount_Business Address");
20  psListOfAccBusAdd.AddChild(psAccBusAdd);
21
22  psAccount.SetType("Account");
23  psAccount.SetProperty("Name", "MyAccount");
24
25  // adding the children of the Account IC
26  psAccount.AddChild(psListOfAccBusAdd);
27  psAccount.AddChild(psListOfContact);
28
29  psListOfEAIAccount.SetType("ListOfEAI Account");
30  psListOfEAIAccount.AddChild(psAccount);
...

NOTE: The script is provided as an example only. To successfully use the script, you will need to define the local variables, set up error handling, and destroy objects.

No comments:

Post a Comment