Note : This blog is only meant to show you how to start developing mobile applications with SUP. Most of the information provided here can be found in the online help onSyBooks Online. Do not hesitate to read the official documentation, it contains much more details and some great tutorials.
Developing Mobile Applications with Sybase Unwired Platform (2/3)
Mobile Business Objects Creation
Our mobile application will allow the user to search for flights, display the results and provide the details of a particular flight. We need to create a Mobile Business Object (MBO) to define our business logic.
Start Sybase Unwired Workspace and select Newthen Mobile Application Project in the File menu to create a new project. Type in the project name (i.e MyFlights) then click Finish :
Right click on the Mobile Application Diagramand select Add Mobile Object to create a new MBO :
Type in the name of the MBO (i.e Flights) then click Next then specify the data source we defined in the previous blog :
Click Browse in the Method Definition panel to display the Browse Operation window. Type in the name of the BAPI (i.e BAPI_FLIGHT_GETLIST), click Search BAPIs/RFCs and select the GetList BAPI then click OK :
Select the parameter you want to map as an output attribute (i.e FLIGHT_LIST) by checking the Out checkbox :
Make sure the Result Checker is set to None then click Finish. You should see the new FlightsMBO in the Mobile Application Diagram:
In order to show the availability of a particular flight, we will need to define a new MBO and link it to the Flights MBO.
Repeat the previous steps to create a second MBO called FlightAvail using the BAPI_FLIGHT_CHECKAVAILABILITYBAPI. Select AIRLINEID, CONNECTIONID and FLIGHTDATE as input arguments and AVAILABILITYas the output attribute :
The new MBO should be visible in the Mobile Application Diagram :
Click onRelationship in the Palette then click on the Flights MBO and drag to the FlightAvail MBO to create a new relationship between the 2 MBOs. Select One to one and uncheck Bi-directionalthen map the Flights MBO attributes to the corresponding FlightAvail parameters :
Choose Yes in the next dialog to create a primary key :
Synchronization Parameters Definition
The user should be able to search for flights using 3 parameters : flight date, airport (departure) and airport (destination). Flights that do not meet these criteria should not be synchronized; we don’t need to have ALL flights on the device.
Select the Flights MBO in the Mobile Application Diagram then click on the Properties tab. Select the Synchronization tab and click on Add :
Add 3 parameters FLIGHTDATE, AIRPORTFR and AIRPORTTO and map them to the corresponding attributes :
Before creating the mobile application, we need to deploy our project on the Sybase Unwired Server.
In the Workspace Navigator, right click on theMyFlights project then select Deploy Project… Accept the default settings and on the Target Serverscreen, click connect then Finish :
You are now ready to develop the mobile application itself. I will show you how to do this using the tools provided by Sybase in my next blog.