Sample business object properties

This section provides an example of a WebSphere business integration business object. The corresponding CORBA class and Java proxy class are also provided to illustrate the mapping across the three constructs. Note that business objects inherit their names from the matching CORBA application objects.

The samples provided in this section are as follows:

Sample IDL file

The following sample code is a portion of a larger IDL file. The portion provided here illustrates definitions for the CORBAAccount struct and for the Hello interface which uses that class for method argument types.

# Sample IDL File
 #
 #
 module corbaadapter
 {
 .
 .
 .
     struct CORBAAccount
     {
         short                       accessCustomerNumber;                
         AccountStatusEnum           accountStatus;                 
         string                      acctSecurity;                  
         string                      companyNm;                        
         long                        custAcctID;                         
         string                      disconnectReasonCd;         
         string                      firstNm;       
         string                      lastNm;                      
         char                        middleInitial;                   
         CORBASicCodeUnion           sicCode;
         CORBAAddressSeq             addresses;
         LongSeq                     custAcctChildrenIds;                 
         StringSeq                   nameList;
         ShortSeq                    accountList;
         BooleanSeq                  flagList;
         CharSeq                     initialList;
         FloatSeq                    amountList;
         DoubleSeq                   doubleAmtList;
     };
     
     
     interface Hello
     {
         CORBAAccount sayHello(in CORBAAccount test, inout double amount);
         
         CORBAAccount sayInOutHello(inout CORBAAccount test,
  inout string name,
  in long id);
     };
 };
 

Sample Java code generated by IDLJ

The following examples illustrate Java code generated by the IDLJ compiler tool from the code in Sample IDL file.

Sample Java code: CORBAAccount class

The following sample code is a portion of the Java code generated by the IDLJ compiler tool for the CORBAAccount struct defined in Sample IDL file.

package corbaadapter;
  
 /**
  * <ul>
  * <li> <b>IDL Source</b>    "d:/corba adapter/sample/hello.idl"
  * <li> <b>IDL Name</b>      ::corbaadapter::CORBAAccount
  * <li> <b>Repository Id</b> IDL:corbaadapter/CORBAAccount:1.0
  * </ul>
  * <b>IDL definition:</b>
  * <pre>
  * struct CORBAAccount {
   ...
 };
  * </pre>
  */
 public final class CORBAAccount implements org.omg.CORBA.portable.IDLEntity {
   
   public short accessCustomerNumber;
   
   public corbaadapter.AccountStatusEnum accountStatus;
   
   public java.lang.String acctSecurity;
   
   public java.lang.String companyNm;
   
   public int custAcctID;
   
   public java.lang.String disconnectReasonCd;
   
   public java.lang.String firstNm;
   
   public java.lang.String lastNm;
   
   public char middleInitial;
   
   public corbaadapter.CORBASicCodeUnion sicCode;
   
   public corbaadapter.CORBAAddress[] addresses;
   
   public int[] custAcctChildrenIds;
   
   public java.lang.String[] nameList;
   
   public short[] accountList;
   
   public boolean[] flagList;
   
   public char[] initialList;
   
   public float[] amountList;
   
   public double[] doubleAmtList;
  
   public CORBAAccount () {
   }
  
 .
 .
 .
 }
 

Sample Java code: HelloOperations class

The following sample code is the Java class generated by the IDLJ compiler tool for the Hello interface defined in Sample IDL file.

package corbaadapter;
  
 /**
  * <ul>
  * <li> <b>IDL Source</b>    "d:/corba adapter/sample/hello.idl"
  * <li> <b>IDL Name</b>      ::corbaadapter::Hello
  * <li> <b>Repository Id</b> IDL:corbaadapter/Hello:1.0
  * </ul>
  * <b>IDL definition:</b>
  * <pre>
  * interface Hello {
   ...
 };
  * </pre>
  */
 public interface HelloOperations {
   /**
    * <pre>
    *   corbaadapter.CORBAAccount sayHello (in corbaadapter.CORBAAccount test,
                                    inout double amount);
    * </pre>
    */
   public corbaadapter.CORBAAccount sayHello (corbaadapter.CORBAAccount test, 
                                      org.omg.CORBA.DoubleHolder amount);
  
   /**
    * <pre>
    *   corbaadapter.CORBAAccount sayInOutHello (inout corbaadapter.
                             CORBAAccount test,inout string name, in long id);
    * </pre>
    */
   public corbaadapter.CORBAAccount sayInOutHello
         (corbaadapter.CORBAAccountHolder test,org.omg.CORBA.StringHolder 
          name, int id);
 

Sample business objects for Java classes

The following sample screens illustrate the business object structure, as viewed in Business Object Designer, for the Java classes defined in the examples in Sample Java code generated by IDLJ.

Figure 13 illustrates the business object structure for the CORBAAccount class.


Figure 13. Business object structure for CORBAAccount class

Figure 14 illustrates the structure of the Hello business object that corresponds to the CORBA Hello interface.


Figure 14. Business object structure for Hello interface

Sample BO handler method calls

For the CORBA objects defined in Sample IDL file, the connector BO handler could make the following method calls.

//Initialize ORB
  
       ORB orb = ORB.init(args, orbProps);
       System.out.println("ORB initialized");
       byte[] helloId = "HelloServerObject".getBytes();
       Hello helloRef = HelloHelper.bind(orb, "/CORBAServer", helloId);
       // Call the Hello server object and print results
       CORBAAccount customer = new CORBAAccount();
       customer.accessCustomerNumber = 0;
             customer.accountStatus = AccountStatusEnum.asPENDING;
       customer.acctSecurity = "check";
       customer.companyNm = "Hello";
            customer.custAcctID = 100;
       customer.disconnectReasonCd = "Reason";
       customer.firstNm = "Name check";
             customer.lastNm = "Last Name";
       customer.middleInitial = 'D';
       CORBASicCodeUnion sicCodeUnion = new CORBASicCodeUnion();
       CORBASicCode sicCode = new CORBASicCode();
       sicCode.description = "Description";
       sicCode.sicCd = "1000";
       sicCode.stdCdInd = 'N';
       sicCode.subAcctInd = 'S';
       sicCodeUnion.value(sicCode);
       customer.sicCode = sicCodeUnion;
       customer.addresses = new CORBAAddress[0];
       customer.custAcctChildrenIds = new int[0];
       double value = 123;
       DoubleHolder dHolder = new DoubleHolder(value);
       customer = helloRef.sayHello(customer, dHolder);
 

Copyright IBM Corp. 1997, 2003