How to build the application with Business Component
The UNICOM® Digital Transformation Toolkit (UDTT™) business component application consists of two parts: server side and client side.
The client side application is a RCP plug-in. Business component provides a lot of pre-build SWT UI composites that can be involved in the client application. These pre-build UI can be customized by the external configuration files. Business Component provides the flexibility that some components, such as EJ and Cash Drawer Management, can be deployed on either the server side or the client side. For example, the journal can be recorded on the client side or the server side. EJ and EJ viewer components support the two ways in the same API with almost the same configuration. The difference is that the application needs to define an EJ service proxy of UDTT Remote on the client side when EJ service is deployed on the server side.
Client side configuration of business component application
In the client side, Business component provides common and integrated configuration way for different subcomponents.
See the following figure for example of the Eclipse plug-in extension configuration.
To display the navigator item in RCP, the RCP activity should be defined. Business Component provides a common BCActivity. The parameter of the activity should be com.ibm.btt.bc.ej.viewer.impl.EJViewerCompositeFactory;ejvconfig. The first part of parameter before the semicolon defines the factory to create the SWT composite. The second part, ejvconfig, is the configuration object ID in element factory configuration file.
When RCP is launched, the client application should initialize the configuration by following example code in Activator class.
elementFactory = new UniversalElementFactory("jar:///bttconfig/bttconfig.xml"); BTTFactory.setElementFactory(elementFactory); XUIEngine.init("jar:///bttconfig/xuiengine.xml");
The following is the root configuration file example, bttconfig.xml. It imports sub configuration and defines a macro definition of the UDTT Remote service. This UDTT Remote macro definition can be used by EJ, Override, Access Control, Cash Draw configuration.
The following is the content of EJ Viewer configuration file, ejViewer.xml.
Note Configuration object, ejvconfig, referenced by the BCActivity parameter is defined here. In this example, the EJ service is deployed in server side. So in the first line, there is a definition of EJ service proxy by the UDTT remote macro definition. Through the EJ viewer configuration, the application can control the layout and EJ fields of query condition and query result UI panel. For example, the application can set the width or height of the panel, and set the column number and field name and order.
As mentioned above, the transaction UI on the teller desktop is implemented with RCP XUI. So we need to define the following XUI definition files for the example. Each transaction has two XUI files; one is for the request, and the other for response. The following figure shows how to define the activity property for transactions with XUI.
▪ DepositeReq.xui
▪ DepositeResponse.xui
▪ withdrawReq.xui
▪ withdrawResponse.xui
The following is the sample content of the DepositeReq.xui file.
Note The items with dataName defined, XUI engine will automatically creates a keyed Collection with the fields with the same name and values as the XUI fields with dataName defined when submission is executed.
According to the above XUI definition, when the Submit button is clicked, the DepositeAction action is executed. In the implementation of the transaction action class, the code should check if override is needed. Then the application can call the server side operation or command chain to send the transaction request data to the host. After transaction response data is returned, the action displays the transaction response UI with the XUI engine.
In the configuration example, we use command chain to implement server side transaction handling. In this definition example, the definition is clear and flexible to add or remove the command. Also the command is highly reused.