38
Stan Stadelman, Sybase Enterprise Mobility Group MOB260 Mobile Business Objects Modeling for Synchronized Mobile Applications

Mobile Business Objects Modeling for Synchronized Mobile Applications

Embed Size (px)

DESCRIPTION

SAP session and hands on Mobile Business Objects Modeling for Synchronized Mobile Applications

Citation preview

Page 1: Mobile Business Objects Modeling for Synchronized Mobile Applications

Stan Stadelman, Sybase Enterprise Mobility Group

MOB260Mobile Business Objects Modeling for Synchronized Mobile Applications

Page 2: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 2

MOB260

Purpose of the session:

• Develop a MBO diagram mapped to database and web service data sources

• Generate Object API code

• Develop BlackBerry Java native application with synchronization

Page 3: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 3

Planned SAP Mobility Platform

Back ends running SAP softwareThird-party services

Sybase Unwired Platform 2.x

SDK* on MBO**

Reusable libraries

OData

ODataBAPIWrapper(Suite)

Web serviceJDBCRest

MBO

Data consolidation and distribution

Notifications andsubscriptions

Other connector technologies

Onboarding, monitoring

lifecycle, and administration

Afa

ria

Sy

bas

e d

eve

lop

men

t to

ols

an

d li

fecy

cle

SAP Business ByDesign SAP BusinessObjects solutionsSAP Business Suite

OData: data provider (such as SAP NetWeaver Gateway)

ODataconnector

SDK on OData+

Apps (native, container)

*Software development kit ** Mobile business object +Open Data ProtocolThis presentation and SAP‘s strategy and possible future developments are subject to change and may be changed by SAP at any time for any reason without notice. This document is provided without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement

ONE mobility platform

Page 4: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 4

MOB 260

Required resources (included on TechEd image)

SUP 2.0.x (Server, Eclipse WorkSpace)

Research In Motion Eclipse Java Plugin v1.3 available: http://us.blackberry.com/developers/javaappdev/

Research In Motion BlackBerry Simulator 9800

CustomerSample code snippets (referenced in Tutorial: BlackBerry Application Development – SUP 2.0 documentation @

infocenter.sybase.com) http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01214.0200/doc/misc/

SUP_BB_Custom_Dev_Tutorial_code.zip

Page 5: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 5

Expectations

Tasks in the development process are broken into 12 stages

Expectation is that participants should keep up on the current stage Time will be allocated for working between stage discussions Please hold questions until the stage has been discussed

Exception: Stage 11 (Adding the Java class files) and Stage 12 (Deploy Application to Simulator) will be combined in

discussion, then adequate time will be provided for work on Stage 11.

Page 6: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 6

Sequence

1. Create MBO from Web Service

2. Create MBO from Database Table

3. Add a WHERE clause to an MBO

4. Add a relationship to an MBO

5. Map a MBO relationship to a service parameter

6. Modify the MBO XSLT (replace with custom XSLT)

7. Deploy MBO's to SUP Runtime

8. Generate Native Object Code for BlackBerry Java ME

9. Create a SUP BlackBerry Application Project in BlackBerry Eclipse Java Plug-in

10. Set up the Application Project

11. Add the Java Class files

12. Deploy Application to Simulator

Page 7: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 7

Tooling

1. Create MBO from Web Service

2. Create MBO from Database Table

3. Add a WHERE clause to an MBO

4. Add a relationship to an MBO

5. Map a MBO relationship to a service parameter

6. Modify the MBO XSLT (replace with custom XSLT)

7. Deploy MBO's to SUP Runtime

8. Generate Native Object Code for BlackBerry Java ME

9. Create a SUP BlackBerry Application Project in BlackBerry Eclipse Java Plug-in

10. Set up the Application Project

11. Add the Java Class files

12. Deploy Application to Simulator

SUP Eclipse WorkSpace

RIM Eclipse Java Plug-in / Device Simulator

Page 8: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 8

1. Create MBO from Web Service

1.1 Create the Connection Profile for the StockQuote web service

• Right-click on 'Web Service' folder in Eclipse Enterprise Explorer, select 'New'

• In the 'Create Connection Profile' wizard, name the service 'StockQuote'

• Specify the location of the service WSDL file. Select 'From URL'.

• Enter: http://www.webservicex.net/stockquote.asmx?WSDL

• Choose 'Test connection' to validate connection.

• Click 'Next', then 'Finish'

Page 9: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 9

1. Create MBO from Web Service

1.1 Connect to the StockQuote web service

• In Eclipse Enterprise Explorer, right-click on the 'StockQuote' Web Service, and select 'Connect'

Page 10: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 10

1. Create MBO from Web Service

1.2 Create the GetQuote MBO from the GetQuote service

• Drill-down into the StockQuote Web Service, and select the 'GetQuote' service. Drag GetQuote to the Mobile Application Diagram canvas.

• Choose to create the attributes of the new MBO from the service, click Next.

• On the Definition wizard screen, double-click on the XSLT1 to view the XSLT for the service

• Click 'Preview' to test the service. On the Preview screen, enter 'SAP' as the test value for 'symbol'. Click 'Preview'.

Page 11: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 11

2. Create MBO from Database Table

2.1 Modify the sampledb database to include the tables and sample data used in the mobile app by running Portfolio.sql.

• Add the 'Portfolio.sql' file to the Exercise 1 project by dragging/dropping to the folder in Workspace Navigator.

• Select the Connection Profile for Portfolio.sql (corresponding to the database the sql will be operating on).

• Click: Execute All SQL Statements button

Page 12: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 12

2. Create MBO from Database Table

Click icon to add picture

2.2 Create the Portfolio MBO

• Drill-down into sampledb into the Tables folder. Find Portfolio(dba) table. Drag it to the Mobile Application Diagram canvas.

• Click OK on the MBO creation wizard.

Page 13: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 13

3. Add a WHERE clause to an MBO

3.1 Add a Parameter filter to the Portfolio MBO to partition the contents of the Cache Database on the SUP Server by user_id, and allow each user to retrieve only their respective values.

• Click on the Portfolio MBO, and under the Properties Menu, navigate to: Attributes \ Definition. Click: Edit...

• Select Design > Parameters, and add a new Parameter called 'id', of type 'Number’. Map the parameter 'id' to the column 'Portfolio.user_id'.

• Select 'Portfolio.user_id' from the drop-down menu under 'Column'. Right-click on the field under 'Value', and select 'Parameters' to locate the 'id' parameter.

• Select :id, and click 'Paste'.

• Click OK.

Page 14: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 14

4. Add a relationship to an MBO

4.1 Add the Portfolio_Detail MBO to the project

• In the Enterprise Explorer > My Sample Database > sampledb, find the Portfolio_Detail (dba) table.

• Drag the table to the Mobile Application Diagram canvas.

• Click OK on the 'Quick create' prompt.

Page 15: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 15

4. Add a relationship to an MBO

4.1 Create the Relationship

• From the Palette, select 'Relationship'.

• Drag the Relationship connector from the Portfolio to Portfolio_Detail MBO

• Map from +portfolio_id[INT] in the Source MBO (Portfolio) to +portfolio_id[INT] in the Target MBO (Portfolio_Detail)

• Click Finish

Page 16: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 16

5. Map a MBO relationship to a service parameter

5.1 Map the symbol code of the Portfolio Detail to the input parameter of the GetQuote Service.

• From the Palette, select 'Relationship’.

• Drag-and-drop from Portfolio_Detail to the GetQuote MBO.

• Link from the +symbol_cd[string(7)] (symbol code) attribute on the Source MBO (Portfolio_Detail) to the symbol[string] parameter in the Target MBO (GetQuote)

• Click Finish.

Page 17: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 17

6. Modify the MBO XSLT (replace with custom XSLT)

6.1 Change the XSLT to include only the attributes we want in the project.

• Click on GetQuote in the Mobile Applciation Diagram canvas, and in the Properties menu, switch to Attributes>Definition

• Click 'Edit...’

• In the Definition wizard, double-click on the XSLT1 row

• Click on the radio button for 'Define XSLT manually'

• Copy and paste the new XSLT over the existing text in the 'Define XSLT manually' window

Page 18: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 18

6. Modify the MBO XSLT (replace with custom XSLT)

6.2 Preview Results

• In the Definition wizard, click 'Preview...' to test the new XSLT.

• Enter 'SAP' as the Value for the 'symbol' Argument

• Click 'Preview'

Page 19: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 19

6. Modify the MBO XSLT (replace with custom XSLT)

6.3 Verify the Relationship between the Portfolio_Detail MBO and GetQuote MBO.

• Click on the blue 'one-to-many' relationship arrow

• In the Properties window, switch to the 'Mapping' tab

• Verify that +symbol_cd[STRING(7)] is still mapped to the symbol[STRING] parameter on the Target MBO.

Page 20: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 20

6. Modify the MBO XSLT (replace with custom XSLT)

6.4 Delete the getQuoteResult attribute

• Click on the GetQuote MBO, and in the Properties menu, switch to the Attributes > Attributes Mapping tab.

• Select the getQuoteResult attribute row, and click 'Delete'

• The MBO should update to reflect the change

Page 21: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 21

7. Deploy MBO's to SUP Runtime

7.1 Deploy the MBOs

• Switch to the 'Advanced' Developer Profile

• Right-click on the Project name in the WorkSpace Navigator, and select 'Deploy Project'

• For BlackBerry devices, choose 'Replication-based' synchronization.

• Use 'Update' Deploy Mode as default.

• Select all 3 MBOs to deploy to SUP Server

Page 22: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 22

7. Deploy MBO's to SUP Runtime

7.1 Set Server and Service Profiles

• Click 'Connect' to connect to the My Unwired Server

• On the Server Connection Mapping wizard, select the Server connection for the My Sample Database and StockQuote connection profiles.

• Click Finish

Page 23: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 23

8. Generate Native Object Code for BlackBerry Java ME

8.1 Generate the Object Classes from the MBO model

• Right click on the project in the WorkSpace Navigator.

• Select Generate Code

• Click Next to generate code for all three MBOs

• Configure the options for the code generation.

• Click Finish

Page 24: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 24

9. Create a SUP BlackBerry Application Project in BlackBerry Eclipse Java Plug-in

9.1 Create new BlackBerry Project

• Open BlackBerry Java Plug-in 1.3.0 from the desktop.

• Go to File > New > Project

• In the New Project wizard, select BlackBerry > BlackBerry Project

• Click Next

• Name the new BlackBerry Project:

• Click Next

Page 25: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 25

9. Create a SUP BlackBerry Application Project in BlackBerry Eclipse Java Plug-in

9.2 Add the SUP ClientAPI libraries to the build path

• The build path should include the sup_client_rim.jar and UltraLiteJ.jar files

• Switch to the Libraries Tab

• Click 'Add External JARs...'

• Browse to: C:\Sybase\UnwiredPlatform\ClientAPI\RBS\BB

• Select sup_client_rim.jar and UltraLiteJ jars, and click Open.

• Click Finish

• Restart Eclipse if prompted

Page 26: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 26

9. Create a SUP BlackBerry Application Project in BlackBerry Eclipse Java Plug-in

9.3 Add the required SUP ClientAPI libraries to the BlackBerry Simulator filesystem

• Browse to:C:\Sybase\UnwiredPlatform\ClientAPI\RBS\BB

• Copy:CommonClient.cod, sup_client_rim.cod, and UltraLiteJ.cod

• Paste the files to:C:\Eclipse\plugins\net.rim.ejde.componentpack6.0.0_6.0.0.30\components\simulator

Page 27: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 27

10. Set up the Application Project

The example application which we will build is modelled on the publically-available 'Customer Sample' sample code used in the BlackBerry Developer Guide Tutorial for SUP 2.0.

We will create an application with corresponding Java classes, copy the content from the sample code to these classes, then modify the code to match the MBOs and the model.

Files are located at:http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01214.0200/doc/misc/SUP_BB_Custom_Dev_Tutorial_code.zip

Page 28: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 28

10. Set up the Application Project

10.1 Add the application 'Descriptor' manifest

• Enter 'TechEdStocks' as the application Title

• Save the Descriptor file

Page 29: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 29

10. Set up the Application Project

10.2 Copy the generated Object & Functional Classes to the project

• In Eclipse, click on the 'Open Perspectives' menu.

• Select Other > BlackBerry Application Development (default)

• In the Package Explorer window, copy the Exercise1 package folder from Exercise1 > Generated Code/src to TechEdStocks > src

Page 30: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 30

11. Add the Java Class files

11.1 Create the package

• In the Package Explorer, right-click on TechEdStocks, and select New > Package.

• Name the new package: com.sybase.sup.samples.objectapi

• Click Finish

Page 31: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 31

11. Add the Java Class files

11.2 Create a Class

• Right-click the com.sybase.sup.samples.objectapi package, and select New > Class

• Name the new class: TechEdStocks

• Use the other defaults in the wizard.

• Click Finish

Page 32: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 32

11. Add the Java Class files

11.3 Edit TechEdStocks.java

• Open the CustomerSample.java sample code.

• Copy and paste the contents of CustomerSample.java into TechEdStocks.java

• In TechEdStocks.java, we will mostly be replacing var names of Customer* with Portfolio*

• EXCEPT: CustomerSample TechEdStocks (class name)

Example:

Page 33: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 33

11. Add the Java Class files

11.4 Edit PortfolioList.java

• Continue replacements of CustomerPortfolio

• Start to look at the dot-notation getter methods for the MBO-generated Object classes

• Make adjustments to account for differences between the attributes in Customer and in Portfolio

• Specifically: return Portfolio.portfolio.ln, instead of Customer.fName + Customer.lName

• Open the MBO-generated Object class and examine the methods

Page 34: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 34

11. Add the Java Class files

11.5 Edit TechEdStocksScreen.java

• This is the UI for the application• Contains the declaration for the InfoScreen which is pushed onto the

UI stack

• This is also where the SUP methods are calledsynchronize(), submit()

• There are a significant number of modifications to account for the differences between Customer and Portfolio

• Keep in mind that the Customer sample app does not have the Portfolio_Detail MBO or GetQuote MBO

• Recommend that you go slowly through this class, since it contains all the frameworks for additional customization and future projects

Page 35: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 35

12. Deploy Application to Simulator

12.1 Launch app on BlackBerry Simulator

• Right-click on TechEdStocks project, and select Run As > Run Configurations

• Check the box for 'Start MDS-CS Simulator Server on Run'

• Click Run

• Scroll through the Application menu, click to open TechEdStocks application

• Click on the BlackBerry menu button, and select 'Synchronize' to synchronize Portfolios to the simulator.

Page 36: Mobile Business Objects Modeling for Synchronized Mobile Applications

© 2011 SAP AG. All rights reserved. 36

Additional Resources

SUP Developer Resources available on SAP SDN

https://cw.sdn.sap.com/cw/groups/sup-apps

On iTunes

SUP Developer Podcast

Product Documentation

http://infocenter.sybase.com

Page 37: Mobile Business Objects Modeling for Synchronized Mobile Applications

Feedback – MOB260Please complete your session evaluation.

Be courteous — deposit your trash, and do not take the handouts for the following session.

THANK YOU !

Page 38: Mobile Business Objects Modeling for Synchronized Mobile Applications

Thank You!

Stan Stadelman, Product Manager / Sybase Unwired [email protected]