Sybase Unwired Platform 2.0 Mobile Workflow Purchase Order Sample

Mobile Workflow Purchase Order Sample
Sybase Unwired Platform 2.0
DOCUMENT ID: DC01393-01-0200-01
LAST REVISED: May 2011
Copyright © 2011 by Sybase, Inc. All rights reserved.
This publication pertains to Sybase software and to any subsequent release until otherwise indicated in new editions or
technical notes. Information in this document is subject to change without notice. The software described herein is furnished
under a license agreement, and it may be used or copied only in accordance with the terms of that agreement.
To order additional documents, U.S. and Canadian customers should call Customer Fulfillment at (800) 685-8225, fax (617)
229-9845.
Customers in other countries with a U.S. license agreement may contact Customer Fulfillment via the above fax number. All
other international customers should contact their Sybase subsidiary or local distributor. Upgrades are provided only at
regularly scheduled software release dates. No part of this publication may be reproduced, transmitted, or translated in any
form or by any means, electronic, mechanical, manual, optical, or otherwise, without the prior written permission of Sybase,
Inc.
Sybase trademarks can be viewed at the Sybase trademarks page at http://www.sybase.com/detail?id=1011207. Sybase and
the marks listed are trademarks of Sybase, Inc. ® indicates registration in the United States of America.
SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered
trademarks of SAP AG in Germany and in several other countries all over the world.
Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other
countries.
Unicode and the Unicode Logo are registered trademarks of Unicode, Inc.
All other company and product names mentioned may be trademarks of the respective companies with which they are
associated.
Use, duplication, or disclosure by the government is subject to the restrictions set forth in subparagraph (c)(1)(ii) of DFARS
52.227-7013 for the DOD and as set forth in FAR 52.227-19(a)-(d) for civilian agencies.
Sybase, Inc., One Sybase Drive, Dublin, CA 94568.
Contents
Context Summary ..................................................................1
Usage Scenario ......................................................................3
Get Started .............................................................................5
Prerequisites ...................................................................5
Setting Up the Sample ....................................................6
Starting the Sample Project ............................................7
Adding E-mail Users .......................................................9
Configuring E-mail Users ..............................................10
Exploring the Database ................................................12
Exploring MBOs ............................................................12
Mobile Business Objects .....................................13
The Mobile Application Diagram ..........................13
Exploring the Mobile Workflow Interface Design ..........15
The Mobile Workflow Forms Editor ......................15
Try It Out ...............................................................................17
Deploying the Sample MBOs to Unwired Server ..........17
Registering Device Users .............................................19
Running the Sample on an iOS Simulator ....................22
Generating the Mobile Workflow Package ...........22
Preparing iOS Devices for the Mobile Workflow
Package ...........................................................25
Configuring the Sybase Messaging Client ...........28
Creating Purchase Orders ...................................30
Approving Purchase Orders ................................37
Running the Sample on a Windows Mobile Emulator ...37
Generating the Mobile Workflow Package ...........38
Preparing Windows Mobile Devices for the
Mobile Workflow Package ...............................40
Creating Purchase Orders ...................................42
Approving Purchase Orders ................................47
Learn More ...........................................................................51
Mobile Workflow Purchase Order Sample
iii
Contents
Related Reference ........................................................51
Project Artifact Reference ....................................51
Data Access Layer Reference .............................52
Learn More about Sybase Unwired Platform ................53
Getting Help ..................................................................54
Index ..................................................................................55
iv
Sybase Unwired Platform
Context Summary
Context Summary
Use the Purchase Order sample to explore artifacts and the resulting mobile workflow
package, the development environment, the underlying components, and interactions
between the underlying components.
The Purchase Order (PO) sample is based on a development environment that uses:
•
•
Sybase® Unwired Platform for Eclipse
Mobile Workflow device development
Using this sample provides a comprehensive overview of the benefits Mobile Workflows can
offer, without your having to program a mobile workflow package. To learn how to create a
mobile workflow package, see Tutorial: Mobile Workflow Package Development.
Next steps
1. Review the Usage Scenario on page 3, which explores the business context and use case
for the sample.
2. Follow the setup process in Get Started on page 5 to install and prepare artifacts in the
Eclipse edition of Unwired Platform.
3. Test functionality and features as described in Try It Out on page 17.
Download attached files here.
Mobile Workflow Purchase Order Sample
1
Context Summary
2
Sybase Unwired Platform
Usage Scenario
Usage Scenario
SybCompany provides its employees with a mobile workflow for their mobile devices, which
allows them to create and approve purchase orders remotely.
Business requirements for SybCompany include:
•
•
•
•
Reduced purchase order turnaround time – by supporting remote reporting, SybCompany
can decrease purchase order approval wait times and thereby offer superior internal
support. Reduced response times offer a competitive advantage to other companies.
Reduced maintenance and more simplicity – the mobile workflow package must easily
deploy with little or no employee intervention. The employee user base does not want to
spend time troubleshooting or self-supporting.
Secure transactions – the employee (with credentials stored on an LDAP server) must be
authenticated, and secure transmission of confidential internal data across the wireless
network ensured.
Dual-mode operation – employees occasionally travel to remote areas, where mobile
network access can be unreliable. Employees should be able to create and approve
purchase orders offline and then have the purchase order creation or approval sent to the
corporate servers when online access becomes available, using built-in Unwired Platform
technology.
Next: Get Started on page 5 shows you how to set up the sample on your computer.
Mobile Workflow Purchase Order Sample
3
Usage Scenario
4
Sybase Unwired Platform
Get Started
Get Started
There are several tasks to complete before you can use the SybCompany Purchase Order
sample.
1. Review the Prerequisites on page 5.
2. Bring all artifacts into the Unwired Platform development environment for Eclipse. See
Setting Up the Sample on page 6.
3. Open connections to the servers that this sample depends on. See Starting the Sample
Project on page 7.
4. In the PurchaseOrder database, explore the existing tables and relationships that are the
foundation for the mobile workflow package. See Exploring the Database on page 12.
5. Explore the mobile business objects (MBOs) that use the database for the attributes of the
mobile workflow package as well as perform operations against tables in the
PurchaseOrder database. See Exploring MBOs on page 12.
6. Review the mobile workflow form interface design in the Mobile Workflow Forms Editor.
The design of the interface correlates to the MBOs that perform database operations. See
The Mobile Workflow Forms Editor on page 15.
Prerequisites
Before you begin importing and setting up the sample, review and complete the prerequisites.
•
•
•
•
•
Install Unwired Platform and choose Eclipse as your development platform.
For Windows Mobile, install:
• Windows Mobile simulator (or have access to an actual device)
• Windows Mobile 6.0 SDK or higher
• Active Sync 4.5
• .NET Compact Framework 3.5
For iOS, install:
• iOS simulator (or have access to an actual device)
• Xcode 3.2.6 (MacBook or iMac) with iOS SDK 4.3.x
Note: Although BlackBerry is a supported platform, procedures for BlackBerry are not
described in this sample. See the Mobile Workflow Employee Directory Sample and
Developer Guide for Mobile Workflow Packages for information on BlackBerry support
for Mobile Workflow applications.
Start the simulator or connect the device.
Start Unwired Server:
Mobile Workflow Purchase Order Sample
5
Get Started
•
•
In Windows, select Start > Programs > Sybase > Unwired Platform > Start Unwired
Platform Services.
Start Sybase Control Center:
In Windows, select Start > Program > Sybase > Sybase Control Center.
Log in using:
User ID : supAdmin
Password: s3pAdmin
Setting Up the Sample
Import the sample project archived in PurchaseOrder_for_SUP2.0.0.zip into
Sybase Unwired Platform.
1. Start Unwired WorkSpace and choose your workspace by clicking Start > Programs >
Sybase > Unwired Platform > Unwired WorkSpace.
2. Import PurchaseOrder_for_SUP2.0.0.zip.
a) Click File > Import.
b) In the Import wizard, select General > Existing Projects into Workspace and click
Next.
c) Choose Select archive file and browse to the location where you saved
PurchaseOrder_for_SUP2.0.0.zip.
d) Click Finish to import the artifacts in the archive as a project.
3. Edit the file that starts the back-end database used by this sample.
a) In WorkSpace Navigator, expand the PurchaseOrderSample > DB folder, right-click
the run.bat file, and select Open With > Text Editor .
b) Modify the values for the variables in this file as required so the command line uses
appropriate values for your environment.
6
Sybase Unwired Platform
Get Started
Variable
Description
ASA_DIR
Sets the root directory location of the server that hosts the sample
SybCompany database.
For example, the default location is:
C:\Sybase\UnwiredPlatform\Servers\SQLAnywhere11
Note: If you are running the sample on a 64-bit machine, you should
additionally edit the beginning of the start command from:
start /min "Purchase Order DB" "%ASA_DIR%
\BIN32\dbsrv11.exe"
to read:
start /min "Purchase Order DB" "%ASA_DIR%
\BIN64\dbsrv11.exe"
PROJECT_DIR
Sets the project directory, for example, C:\Documents and
Settings\<username>\workspace.
Ensure this path points to the location where your project resides. To
see the location, right-click on the project and select Properties >
Resource.
MACHINE_NAME
Enter the name of your machine.
Note: Enter the following command at the command prompt to determine the machine name:
echo %computername%
c) Save and close the run.bat file.
4. Right-click run.bat and select Open With > System Editor.
The database starts and the icon for the new instance appears in the system tray.
Starting the Sample Project
Once you have imported the sample and started the PurchaseOrder database server, you can
browse artifacts and open required server connections.
1. In WorkSpace Navigator, expand the PurchaseOrderSample folder to view the project
artifacts.
Mobile Workflow Purchase Order Sample
7
Get Started
When you import the project, errors are generated, as indicated by the red "x" beside the
root folder and the Deployment folder. These errors are resolved as you set up your project
for your environment.
Project artifacts are contained in these folders: Mobile Business Objects, DB, and
Deployment. For a description of all artifacts contained in this project, see Project Artifact
Reference on page 51.
2. Create a connection profile and connect to the PurchaseOrder database:
a) In Enterprise Explorer, right-click the Database Connections folder and select
New.
b) In New Connection Profile, select Sybase ASA as the connection profile type, in
Name, enter PurchaseOrderDB, and click Next.
c) In Drivers, select ASA v 11.x for Unwired Server Default, and configure these
connection properties:
Property
Value
Host
The default is localhost.
Port
2648
Database name
PurchaseOrder
User name
Use the default, dba.
Password
Use the default, sql.
Save password
Select this option.
When you are finished, click Test Connection.
d) Click OK in the Ping Succeeded window.
e) Click Finish.
A PurchaseOrder database connection profile is added. When you connect to the
server, a complete set of database elements appears below the PurchaseOrder icon.
This new profile should resolve any connection profiles errors you received when you
imported the PurchaseOrderSample project. If it does not, ping the server to see
whether or not it is available.
Connect
to the Unwired Server:
3.
a) In Enterprise Explorer, expand the Unwired Server folder.
b) Right-click the My Unwired Server icon and choose Connect.
When you connect to the server, a complete set of administrable elements appear below
the server icon.
8
Sybase Unwired Platform
Get Started
Adding E-mail Users
Goal: Set up e-mail user accounts so you can test the Mobile Workflow on the emulator.
Prerequisites
If an e-mail server is not available for testing, you can use the James Server from Apache,
which is an open source e-mail server.
The James Mail Server requires a Java Runtime Environment of Java version 1.4 or higher
installed to run the James application. A JRE must be downloaded and installed before James
can run. In addition, the environment variable JAVA_HOME must be set to the JRE home
directory before running James.
Task
This procedure uses an open source POP3 e-mail server called James Mail Server, but you can
use any e-mail server.
1. Go to http://james.apache.org/.
2. Download the james-binary-2.3.2.zip file.
3. Unzip the file, for example, to C:\james.
4. Go to C:\james\james-2.3.2\bin and execute run.bat.
You see the James Mail Server window.
Note: The IIS default SMTP server might be occupying the port to which James connects.
If you have trouble connecting to the James Mail Server, you can either (1) shut down the
IIS SMTP server, or (2) change the port number to avoid conflict.
Mobile Workflow Purchase Order Sample
9
Get Started
5. Launch a command prompt window and, at the C: prompt, enter: telnet localhost
4555.
6. In the James Remote Administration window, enter:
• Login ID: root
• Password: root
7. Add the e-mail users using the adduser command, for example:
adduser user1 pass123
adduser manager1 pass1234
adduser multiplexer pass12345
8. Enter quit when you are finished adding e-mail users.
Configuring E-mail Users
This example uses three e-mail accounts that can use any name you choose. In this sample,
they are called user1, manager1, and multiplexer.
The e-mail address multiplexer is used in the CC field when a Mobile Workflow e-mail
message is sent. The user1 e-mail account is used by the person who is creating purchase
orders, and the manager1 e-mail account is used by the person who approves or declines a
purchase order.
1. Once you have created the e-mail users, double-click the sample.sql file located in the
DB folder.
10
Sybase Unwired Platform
Get Started
2. Make adjustments to the InsertPurchaseOrderTrigger, ensuring that the correct e-mail
address is used for the notification mailbox (the default is multiplexer@localhost).
3. Modify the smtp_server value from localhost to the actual smtp_server name if the e-mail
server is running on a different machine than Unwired Server.
For example, to reconfigure James to run on port 2525, instead of the default port 25,
change:
CALL xp_startsmtp('multiplexer@localhost', 'localhost');
*smtp_sender, smtp_server*/
/
to:
CALL xp_startsmtp('multiplexer@localhost', 'localhost', 2525);
*smtp_sender, smtp_server, smtp_port*/
/
4. Adjust the e-mail addresses used for the PurchaseOrderApprover.
5. Ensure that the following values are correctly entered for the PurchaseOrderDB
connection profile you created.
Field
Example Value
Type
Sybase_ASA_11.x
Name
PurchaseOrderDB
Database
PurchaseOrder
6. Select File > Save.
Mobile Workflow Purchase Order Sample
11
Get Started
7. Right-click sample.sql, and select Execute SQL Files.
Exploring the Database
If you have started and connected to the database, you can now explore its structure and
design.
The tables and relationships have been explicitly designed for this sample. By understanding
the structure of the database, you can better understand how the business logic programmed
into the mobile workflow works with the database.
1. In Enterprise Explorer, expand Databases > PurchaseOrderDB > PurchaseOrder.
2. Right-click Purchase Order, and select both Show Schema and Show Owner.
3. To browse the tables used by the mobile application, expand PurchaseOrder > Schemas
> dba > Tables.
The database has three tables: PurchaseOrder, PurchaseOrderApprover, and
PurchaseOrderLineItem. Expand each table to review the table design for each (columns,
keys, constraints, and so on).
Table names have a one-to-one relationship with the mobile business objects (MBOs) that
create the business logic for the workflow.
To explore the relationship between tables and MBOs more closely, open the Mobile
Application Diagram. For information on MBOs and diagrams, see Mobile Business
Objects on page 13 and The Mobile Application Diagram on page 13.
For more information on the database structure, see Data Access Layer Reference on page
52.
Exploring MBOs
Review the existing attributes and operations for mobile business objects, look at relationships
among various mobile business objects, and explore how MBOs are bound to the
PurchaseOrder table as their back-end data source.
1. In WorkSpace Navigator, expand the PurchaseOrderSample > Mobile Business
Objects folder to view the MBOs created for this sample.
There is a one-to-one correspondence between the names of the MBOs and the table
names of PurchaseOrder.
2. To see the relationships among these MBOs, and to understand the business logic behind
them, right-click any MBO and select Open in Diagram Editor.
12
Sybase Unwired Platform
Get Started
Mobile Business Objects
Mobile business objects form the business logic for mobile applications and workflows.
The data aspects of the Mobile Workflow application are called mobile business objects
(MBO), and “MBO development” refers to defining object data models with back-end
enterprise information system (EIS) connections, attributes, operations, and relationships.
Mobile Workflow applications can reference one or more MBOs and can include load
parameters, personalization, and error handling.
The Mobile Application Diagram
Each mobile application project has an associated Mobile Application Diagram that provides
a graphical representation of all mobile business objects (MBOs) within the project.
The Mobile Application Diagram is not only a static graphical representation of MBOs. You
can copy and paste existing objects, create a new object, or even define data sources for MBOs
that are not yet bound to a back-end repository. However, the application diagram used in this
sample is complete as provided.
Mobile Workflow Purchase Order Sample
13
Get Started
What the Mobile Application Diagram shows
The diagram shows the different objects and how they are related to each other :
•
•
•
14
PurchaseOrder MBO – represents a single purchase order.
PurchaseOrderLineItem MBO – represents a line item in a purchase order. Each purchase
order has one or more line items. Line items are unique to a specific purchase order.
PurchaseOrderApprover MBO – represents an employee who is allowed to approve
purchase orders.
Sybase Unwired Platform
Get Started
Exploring the Mobile Workflow Interface Design
Use the Mobile Workflow Forms Editor to explore the mobile workflow package.
Business logic is not stored in the mobile workflow package. Instead, the mobile workflow
package relies on the MBOs that are deployed to the Unwired Server to provide the business
logic. The separation of the workflow interface from the processing and logic components
keeps the workflow compact and makes more efficient use of the client device’s battery.
1. In WorkSpace Navigator, double-click PurchaseOrder.xbw.
2. Click the Flow Design tab to explore the flow of all existing screens. You can also see each
individual screen by selecting it, then clicking the Screen Design tab.
The Mobile Workflow Forms Editor
The Mobile Workflow Forms Editor consists of views and pages that allow you to model the
interface of the device screens.
The Mobile Workflow Forms Editor has drag-and-drop functionality, which allows you to
drag and drop mobile business objects onto the Flow Design page. You can also drag and drop
mobile business object operations onto the Flow Design page. The Mobile Workflow Forms
Editor contains three pages:
Introduction
Creating a new custom device workflow, or double-clicking an existing one, opens the
Introduction section of the Mobile Workflow Forms Editor. This page is the starting point for
designing your custom device mobile workflow. You can access help and launch tutorials
from this page.
Flow Design
Use this page to specify the manner in which screens link together. You can then link specific
screens and actions to a mobile business object on a server. The Palette view shows available
screens and connections.
The Flow Design page displays an empty canvas with the Palette to the right, which shows the
available screens and connections. You can drag and drop items from the Palette to the canvas.
Screens that you drag to the Flow Design canvas are displayed as icons and show the
connection lines between them. Dragging a new screen into this page starts a new screen.
Double-clicking a screen opens the Screen Design page.
Right-clicking anywhere in the Flow Design page displays a context menu.
Screen Design
Use this page to design the screen of your mobile workflow. The Palette view shows the menu
and controls you can use to design a new screen. Drag controls to design the user interface on
the device screen.
Mobile Workflow Purchase Order Sample
15
Get Started
The Device Workflow toolbar includes a list of existing screens. You can open a different
screen by selecting the corresponding screen name from the list.
16
Sybase Unwired Platform
Try It Out
Try It Out
The PurchaseOrder sample lets employees away from the office create and approve purchase
orders without having to update information between site visits.
Before you can use the sample, you must:
1.
2.
3.
4.
Deploy the sample MBOs to an Unwired Server.
Register device users, and configure device properties and distribution rules.
Deploy the mobile workflow to the simulator or device.
Start the sample on the simulator or device, and log in to an Unwired Server.
Deploying the Sample MBOs to Unwired Server
Deploy the sample to the Unwired Server to make the MBO logic available to the user
interface (purchaseOrder.xbw).
Prerequisites
Ensure you are connected to an Unwired Server.
Task
There are multiple techniques you can use to deploy the mobile application. This sample
documents how to deploy the sample from the project. For information on the other options,
open the Unwired Platform online help and click Sybase Unwired WorkSpace - Mobile
Business Object Development > Develop > Packaging and Deploying Mobile Business
Objects.
1. Right-click the PurchaseOrderSample project and select Deploy Project.
2. Accept the defaults for the deploy mode, target version, and package name. Select
Message-based, and click Next.
Mobile Workflow Purchase Order Sample
17
Try It Out
3. Select all boxes to deploy all MBOs and click Next.
4. (Optional) In the Packager User-defined Classes window, click Next.
This window is only seen if you are using the Advanced Developer Profile.
5. Accept the defaults for Domain and Security configuration, and click Next.
6. If you are using the Advanced profile, map the connection profile for PurchaseOrderDB to
the Server connection profile of the same name.
a) From Server Connection, select New Server Connection.
b) Accept the defaults and click OK. This mapping process creates an Unwired Server
connection profile to the PurchaseOrder database.
7. Since you do not need to map roles or create a deployment profile for this sample, click
Finish to deploy the package to the Unwired Server.
18
Sybase Unwired Platform
Try It Out
Registering Device Users
Use the Sybase Control Center to register device users, set device properties, and configure
e-mail settings for the workflow package.
1. In the left pane in Sybase Control Center, click Device Users, then click the Devices
tab.
2. Click Register and specify these properties:
Property
Value
User name
The device user name, for example, user1.
Template
Use Default.
Server name
Enter the machine name on which Unwired Server is running and
include the full domain, for example, supmachine.sybase.com.
Port
Accept the default value of 5001.
Farm ID
If using a Relay Server, enter the server Farm ID. Otherwise, accept the
default value of 0.
Activation code length
Specify the length of the activation code. The default is 3 characters.
Activation expiration
(hours)
The number of hours the activation code remains valid. The default is
72.
Specify activation code
Enter the activation code, for example, 123.
Mobile Workflow Purchase Order Sample
19
Try It Out
3. Repeat step 2 to register the manager1 device user.
4. Select MBS to display the list of message based synchronization devices, and associated
user names.
5. Select the manager1 device user and click Properties.
6. Set the value of Custom 1 to manager1 and click OK.
20
Sybase Unwired Platform
Try It Out
7. In the left pane in Sybase Control Center, click Workflows, then select Notification
Mailbox.
8. Select Enable and specify these properties:
Property
Value
Protocol
Choose between POP3 or IMAP, depending on the e-mail server used.
Server
Enter the machine name where the e-mail server resides.
User name
The e-mail address used when a mobile workflow e-mail message is sent. In
this example, the e-mail address is multiplexer.
Password
The password for this e-mail account. In this example, the password is
pass12345.
Keep the defaults for the other properties.
9. Click Add to add a distribution rule. Use this information for the distribution rule:
•
•
•
•
E-mail attribute – To
Operation – Contains
Device property – Custom 1
Case sensitive – leave unselected
Mobile Workflow Purchase Order Sample
21
Try It Out
These settings specify that e-mail messages that are sent to the multiplexer e-mail address
will be sent as a workflow form to the device on which the the Custom1 property matches
the "To" field in the original e-mail message.
10. Click OK.
11. If you have added at least one distribution rule, you can click Test to test your
configuration. If the test is successful, click Save.
Running the Sample on an iOS Simulator
Generate the mobile workflow package, assign the mobile workflow package to a user,
configure the Sybase Messaging Client, and run the sample on an iOS simulator.
Generating the Mobile Workflow Package
Use the Mobile Workflow Package Generation wizard to generate files for the mobile
workflow package.
1. In the Sybase Unwired Platform workspace that contains the PurchaseOrderSample, in
WorkSpace Navigator, right-click PurchaseOrder.xbw and select Generate Mobile
Workflow Package.
22
Sybase Unwired Platform
Try It Out
2. In the Mobile Workflow Package Generation Wizard, select the options that are
appropriate for your environment.
Option
Value
Generate
Select to generate the mobile workflow package and its files.
When this option is unchecked, the Mobile Workflow package
files are not regenerated, so that user modified files will not be
changed.
Generate into the project
Place the generated mobile workflow package and its files in the
current project.
Generation folder
Select the folder location outside of the current project in which
to save the generated .zip file containing the application and its
generated files.
Mobile Workflow Purchase Order Sample
23
Try It Out
Option
Value
Unwired Server Profile
Select the Unwired Server profile with which to associate the
mobile workflow application and extract the username and
password credentials if you are using static authentication.
Deploy to an Unwired Server
Select to deploy the mobile workflow application to an Unwired
Server. The generated ZIP file is installed as a mobile workflow
package on the selected Unwired Server.
Deploy Mode
•
•
•
Assign workflow to user(s)
New – generates and deploys the mobile workflow package
and its files for the first time.
Update – updates any pre-existing Mobile Workflow package in-place, preserving associated assignments.
Replace – removes any pre-existing Mobile Workflow
package and notifications before deploying.
The mobile workflow must be assigned to a device user before
the mobile workflow is visible on the user's device. Enter the
device users (user1 and manager1) for which the mobile workflow package is available. Use a comma to separate the user
names.
You can also click Get Users to choose from a list of available
users.
Validate controls as soon as the If unselected, validation occurs only when the screen is saved. If
user tries to change focus away selected, validation occurs as soon as the control loses focus. If
from them
validation fails, a help element appears and shows the error
message.
24
Sybase Unwired Platform
Try It Out
3. Click Finish.
A PurchaseOrder.zip file containing the application and its generated files is
created and placed in the specified location.
Preparing iOS Devices for the Mobile Workflow Package
Install the Mobile Workflow client on the device using the App Store, or use the source code
provided for the Mobile Workflow container to deploy to the iOS simulator from the Xcode
project.
Complete these prerequisites before provisioning the Mobile Workflow application:
•
Determine your security policy – Unwired Platform provides a single administration
console, Sybase Control Center, which allows you to centrally manage, secure, and deploy
applications and devices. Device user involvement is not required and you can maintain
Mobile Workflow Purchase Order Sample
25
Try It Out
•
the authorization methods you already have in place. See Sybase Unwired Platform
System Administration > Security Administration.
Register each device using Sybase Control Center – Device registration pairs a user and a
messaging-based synchronization (MBS) device. See Messaging Devices in Sybase
Control Center online documentation.
Installing the Mobile Workflow Container
You can use one of two methods to install the mobile workflow container onto the iPhone
device. You can build the container in Xcode using libraries from the product installation, or
you can download a prebuilt container from the App Store.
Installing the Mobile Workflow Container Using the Provided Source Code
The Workflow Container referenced in this procedure is a sample container. You can use the
provided source code in Xcode to build your own customized user interface and configure
other resources.
Prerequisites
•
•
•
Register the device in Sybase Control Center
You must have a Mac with iOS SDK 4.3 installed.
Xcode 3.2.6 or higher.
Task
1. From your Mac, connect to the Microsoft Windows machine where Sybase Unwired
Platform is installed:
a) From the Apple menu, select Go > Connect to Server.
b) Enter the name or IP address of the machine, for example, smb://<machine DNS
name> or smb://<IP Address>.
2. Copy the MobileWorkflow-2.0.0.tar.gz from your Sybase Unwired Platform
installation <UnwiredPlatform_InstallDir>\UnwiredPlatform
\ClientAPI\Workflow\ios\ to a location on your Mac:
3. Unarchive the MobileWorkflow-2.0.0.tar.gz.
This creates a Workflow folder.
4. In the Workflow folder, double-click WorkFlow.xcodeproj so that it opens in the XCode
IDE.
5. If necessary, add these frameworks from the SDK to the project by selecting Project >
Edit Active Target <ProjectName> > General:
• Security.framework
• AddressBook.framework
• QuartzCore.framework
26
Sybase Unwired Platform
Try It Out
•
•
•
•
CoreFoundation.framework
libicucore.A.dylib
libz.1.2.3.dylib
libstdc++.dylib
6. In XCode, select Build > Build.
The project builds.
Installing the Mobile Workflow Package from the Apple App Store
Install the Mobile Workflow container from the Apple App Store.
This is a free version of the Mobile Workflow and should not be used for enterprise
deployment.
1. On the iOS home page, tap App Store.
2. Search for Sybase.
3. When the Workflow application appears, tap Free.
4. Tap Free again on the Workflow information page.
5. Tap Install to download the application.
6. In Settings > Sybase, for Connection Info, enter:
a) In Connection Info, enter:
• Server Name – varies depending on your environment:
• In a single node environment, use the name of the Unwired Server.
• In a production environment with relay servers, use the name of a deployed
relay server host.
• In a production environment with load balanced relay servers, use the name of
the load balance controller. For example, if you set up an environment using the
Microsoft Web Platform Installer, this would be the name of the Application
Request Router server.
• Server Port – the port used by Unwired Server, or in a relay server-enabled
environment, the port of the relay server. You can use either HTTP or HTTPS ports
for these connections. Contact the platform administrator for production values
you may need. For example, the default relay server HTTP port is 80 and the default
HTTPS port is 443.
• Farm ID – the company ID, or Farm ID registered in the relay server. If you are not
using relay server, use a value of 0.
• User name – the user name you entered for the device in Sybase Control Center.
• Activation Code – the activation code for the device.
7. Scroll to the page that contains the Sybase icon, then tap to launch.
8. Enter your personal identification number (PIN). Choose the number that you need to
enter to start the Mobile Workflow application. This PIN is a security measure to safeguard
your company's data.
Mobile Workflow Purchase Order Sample
27
Try It Out
•
•
•
The PIN must be at least six digits.
(First time/reinstallation) Create a PIN in the Password field, then verify it in the
second field.
(Second or subsequent logins) Enter the PIN in the Password field. Select Change
Password to change the PIN. You can change the PIN once you enter the current PIN.
The Workflows page appears.
9. Click the Messages tab bar, then tap Messages to view the Workflows.
10. (Optional) If instructed by your system administrator, enable notifications on your
device.
Installing the Mobile Workflow Application Using iTunes
Install the Mobile Workflow application using iTunes.
Note: To provision your iOS device for APNs when building your own Mobile Workflow
application, see Developer Guide for Mobile Workflow Packages > Mobile Workflow
Development > Configure the Device for the Mobile Workflow Package > Preparing iPhone
Devices for the Workflow Package > Apple Push Notification Service > Provisioning iOS
Devices.
1.
2.
3.
4.
Launch iTunes.
Download the application from your corporate network to your Applications library.
Sync the Mobile Workflow application to your Apple mobile device.
Specify the connection settings in Settings > Workflow.
Configuring the Sybase Messaging Client
Configure the Sybase Messaging Client before using it.
1. In the Settings for the iOS simulator, choose SUPWorkflows and configure these
connection settings for the Mobile Workflow application:
• Server name – enter the machine name on which Unwired Server is running. Include
the full domain name, for example, supmachine.sybase.com.
• Server port – Unwired Server port number. The default is 5001.
• Company ID – the company ID, or Farm ID registered in the relay server. If you are not
using relay server, use a value of 0.
• User name – the user name you entered for the device in Sybase Control Center. Enter
user1.
• Activation code – enter the activation code (123 in this example) associated with the
device.
28
Sybase Unwired Platform
Try It Out
2. In the iOS application screen, open the SUPWorkFlows applications.
The deployed workflow package is shown in the SUPWorkFlows menu.
3. In Sybase Control Center > Device Users > Devices, select MBS. The device appears
with a status of online.
Mobile Workflow Purchase Order Sample
29
Try It Out
4. Repeat the steps in this procedure to connect the second simulator.
Creating Purchase Orders
Use the workflow package to create purchase orders.
Prerequisites
Set up the user1 e-mail account on the device or emulator.
Task
1. On the iOS simulator for user1, select SUPWorkflows.
30
Sybase Unwired Platform
Try It Out
2. Select the PurchaseOrder mobile workflow.
Mobile Workflow Purchase Order Sample
31
Try It Out
3. Enter the default user name and password (supAdmin and s3pAdmin, respectively).
If you enter the wrong user name and password, you are prompted to reenter them the next
time you perform a submit action.
4. From the menu, choose Find Approver.
32
Sybase Unwired Platform
Try It Out
5. Select Will O. Wisp, whose e-mail address is manager1.
Mobile Workflow Purchase Order Sample
33
Try It Out
6. Fill out the new purchase order.
•
•
•
•
•
34
Type – Hardware upgrade.
Currency – CDN.
Date – enter the current date.
Purpose – 2 GB -> 4 GB.
Approver ID – 1000.
Sybase Unwired Platform
Try It Out
7. To complete the purchase order, select Item List > Add from the menu.
8. Choose Create to add the memory upgrade to the list of items in this purchase order.
• Product – Memory
• Quantity – 2
• Price – 55.96
• Part No. – 89547112
Mobile Workflow Purchase Order Sample
35
Try It Out
•
Description – 2GB DDR2-533 Dell Latitude D620 Memory
Note: This sample demonstrates an error condition if you enter a value greater than 10
for quantity. The PurchaseOrderLineItem mobile business object uses a stored
procedure to perform the create. See the CreatePurchaseOrderLineItem
stored procedure
9. Select Done when you are finished adding items.
36
Sybase Unwired Platform
Try It Out
10. Select Create to send an e-mail message to the selected approver.
11. The Purchase Order is added to the database, but it is not yet approved.
Approving Purchase Orders
Use the workflow package to approve purchase orders.
1. Switch to the device or emulator for manager1 and select Mail.
2. Enter the user name and password (supAdmin/s3pAdmin).
3. The new mobile workflow e-mail message arrives in the inbox.
4. The manager can now approve or reject this purchase order.
5. Once the purchase order is approved or rejected, the PurchaseOrder table shows that the
update succeeded.
Running the Sample on a Windows Mobile Emulator
Generate the mobile workflow package, assign the mobile workflow package to a user,
configure the Sybase Messaging Client, and run the sample on a Windows Mobile emulator.
Mobile Workflow Purchase Order Sample
37
Try It Out
Generating the Mobile Workflow Package
Use the Mobile Workflow Package Generation wizard to generate files for the mobile
workflow package.
1. In the Sybase Unwired Platform workspace that contains the PurchaseOrderSample, in
WorkSpace Navigator, right-click PurchaseOrder.xbw and select Generate Mobile
Workflow Package.
2. In the Mobile Workflow Package Generation Wizard, select the options that are
appropriate for your environment.
38
Option
Value
Generate
Select to generate the mobile workflow package and its files.
When this option is unchecked, the Mobile Workflow package
files are not regenerated, so that user modified files will not be
changed.
Sybase Unwired Platform
Try It Out
Option
Value
Generate into the project
Place the generated mobile workflow package and its files in the
current project.
Generation folder
Select the folder location outside of the current project in which
to save the generated .zip file containing the application and its
generated files.
Unwired Server Profile
Select the Unwired Server profile with which to associate the
mobile workflow application and extract the username and
password credentials if you are using static authentication.
Deploy to an Unwired Server
Select to deploy the mobile workflow application to an Unwired
Server. The generated ZIP file is installed as a mobile workflow
package on the selected Unwired Server.
Deploy Mode
•
•
•
Assign workflow to user(s)
New – generates and deploys the mobile workflow package
and its files for the first time.
Update – updates any pre-existing Mobile Workflow package in-place, preserving associated assignments.
Replace – removes any pre-existing Mobile Workflow
package and notifications before deploying.
The mobile workflow must be assigned to a device user before
the mobile workflow is visible on the user's device. Enter the
device users (user1 and manager1) for which the mobile workflow package is available. Use a comma to separate the user
names.
You can also click Get Users to choose from a list of available
users.
Validate controls as soon as the If unselected, validation occurs only when the screen is saved. If
user tries to change focus away selected, validation occurs as soon as the control loses focus. If
from them
validation fails, a help element appears and shows the error
message.
Mobile Workflow Purchase Order Sample
39
Try It Out
3. Click Finish.
The results of the file generation appear in the Console tab.
Preparing Windows Mobile Devices for the Mobile Workflow Package
Install and configure the container required to prepare a Windows Mobile device to run
Mobile Workflow packages.
1. Navigate to <UnwiredPlatform_InstallDir>\UnwiredPlatform
\ClientAPI\MBS\WM\MoMessaging .
2. Cradle the Windows Mobile device.
3. Connect a USB cable between the PC and device.
4. Copy the Windows Mobile Professional device file, SUPMessaging_Pro.cab, to the
device's My Documents folder.
40
Sybase Unwired Platform
Try It Out
5. Open the .cab file from the Windows Mobile device. This installs the container.
6. In the Connection screen, enter the connection settings. These settings should match the
values you used when you registered the device in Sybase Control Center.
• Server Name – enter the machine name on which Unwired Server is running. Include
the full domain name, for example, supmachine.sybase.com.
• Server Port – the port used by Unwired Server, or in a relay server-enabled
environment, the port of the relay server. You can use either HTTP or HTTPs ports for
these connections. Contact the platform administrator for production values you may
need. For example, the default relay server HTTP port is 80 and the default HTTPS port
is 443.
• Farm ID – the company ID, or Farm ID registered in the relay server. If you are not
using relay server, use a value of 0.
• User Name – the user name you entered for the device in Sybase Control Center. Enter
user1.
• Activation Code – enter the activation code (123 in this example) associated with the
device.
7. Synchronize the device or emulator by uncradling and recradling it.
8. In Sybase Control Center > Device Users > Devices, select MBS. The device appears
with a status of online.
9. In Sybase Control Center > WorkFlows > PurchaseOrder > Devices, verify that the
user1 and manager1 device users are listed. If this is not then case, click Assign
Workflow… to assign them (user1 is associated with the first, and manager1 with the
second device emulator).
10. After verifying that device user user1 has been configured with the first device emulator,
uncradle the first device and then connect to and cradle a second device emulator (a
different WM6 Professional emulator that will be used for the device user manager1)
from the Device Emulator Manager.
11. Cradling will invoke ActiveSync. Click OK to dismiss the information box, and then click
Cancel to exit the Synchronization Setup Wizard, which is not needed.
12. Repeat this procedure to configure device user manager1 on the second device emulator.
Mobile Workflow Purchase Order Sample
41
Try It Out
Creating Purchase Orders
Use the workflow package to create purchase orders.
Prerequisites
Set up the user1 e-mail account on the device or emulator.
Task
1. On the device or emulator for user1, select Start > Messaging, and click or select Text
Messages.
2. Click Inbox to display the mailbox tree, expand the Outlook E-mail branch and click or
select Inbox.
3. Select the Workflows menu item and then click or select the PurchaseOrder mobile
workflow.
42
Sybase Unwired Platform
Try It Out
4. Enter the default user name and password (supAdmin and s3pAdmin, respectively).
If you enter the wrong user name and password, you are prompted to reenter them the next
time you perform a submit action.
5. From the menu, choose Find Approver and then click Menu > Find to obtain the list of
approvers.
6. Select Will O. Wisp, whose e-mail address is manager1, and then click Menu > Done to
return to the Create PO screen.
7. Fill out the new purchase order.
•
•
•
•
•
Type – Hardware upgrade.
Currency – CDN.
Date – enter the current date.
Purpose – 2 GB -> 4 GB.
Approver ID – 1000.
Mobile Workflow Purchase Order Sample
43
Try It Out
8. To complete the purchase order, select Menu > Item List and then click Add to go to the
Add Item screen .
9. Enter the following values and then click Create to add the memory upgrade to the list of
items in this purchase order.
• Product – Memory
• Quantity – 2
• Price – 55.96
• Part No. – 89547112
• Description – 2GB DDR2-533 Dell Latitude D620 Memory
Note: This sample demonstrates an error condition if you enter a value greater than 10
for quantity. The PurchaseOrderLineItem mobile business object uses a stored
procedure to perform the create. See the CreatePurchaseOrderLineItem
stored procedure
44
Sybase Unwired Platform
Try It Out
10. Select Done to indicate that you have finished adding items.
Mobile Workflow Purchase Order Sample
45
Try It Out
11. Select Menu > Create to send an e-mail message to the selected approver.
46
Sybase Unwired Platform
Try It Out
12. The Purchase Order is added to the database, but it is not yet approved.
Approving Purchase Orders
Use the workflow package to approve purchase orders.
1. Switch to the device or emulator for manager1 and select Outlook E-mail. If you are using
two Windows Mobile Professional emulators, cradle the manager1 device.
Mobile Workflow Purchase Order Sample
47
Try It Out
2. Enter the user name and password (supAdmin/s3pAdmin).
3. The new mobile workflow e-mail message arrives in the inbox.
48
Sybase Unwired Platform
Try It Out
4. The manager can now approve or reject this purchase order.
Mobile Workflow Purchase Order Sample
49
Try It Out
5. Once the purchase order is approved or rejected, the PurchaseOrder table shows that the
update succeeded.
50
Sybase Unwired Platform
Learn More
Learn More
Learn about this sample, or get additional help on using Unwired Platform in your enterprise
environment.
•
•
For information about project artifacts, database schemas, and other detailed information
on this sample, see Related Reference on page 51.
For information on how to coordinate your self-directed exploration of Unwired Platform
samples, tutorials, and documentation, see Learn More about Sybase Unwired Platform on
page 53.
To get help or more information, see Getting Help on page 54.
•
Related Reference
Review reference information to understand the implementational and architectural details of
this sample.
Project Artifact Reference
Familiarize yourself with artifacts of this sample.
All project artifacts are imported into Sybase Unwired Platform from the
PurchaseOrder_for_SUP2.0.0.zip file. To explore the contents of the project,
expand the project in WorkSpace Navigator. The top-level folder structure of this sample is
Folder
Contents
Mobile Business Objects
The source files for the MBOs used in this sample, as well as their
required attributes (for example, the table and columns the MBOs
access), and the operations they perform if any.
Data Source References
The pointers to the data source used by the MBOs in the sample. In this
case, there is only one: PurchaseOrderDB.
Roles
The roles defined for the project. The sample project has no roles
defined.
Personalization Keys
The personalization keys defined for the project. The sample project
has no personalization keys defined.
DB
The database files used as the back-end repository for the sample.
These files include the .BAT file that starts the database with all required properties, the database file itself, and its corresponding log
file.
Mobile Workflow Purchase Order Sample
51
Learn More
Folder
Contents
Deployment
The folder where all applicable deployment files are saved.
Data Access Layer Reference
The entity relationship is described in the consolidated database model (PurchaseOrder).
This table summarizes the schema for the database:
Table
Column
Data type
Primary
key
PurchaseOrder
ID
Integer
Y
ExpenseType
varchar(50)
Currency
varchar(50)
RequestDate
date
Purpose
varchar(500)
Approved
char
PurchaseOrderApproverID
integer
ID
Integer
Name
varchar(40)
e-mail
varchar(50)
ID
Integer
ProductName
varchar(40)
Quantity
integer
Price
decimal
PartNum
integer
Description
varchar(100)
PurchaseOrderID
integer
PurchaseOrderApprover
PurchaseOrderLineItem
52
Y
Y
Sybase Unwired Platform
Learn More
Learn More about Sybase Unwired Platform
Once you have finished, try some of the other samples or tutorials, or refer to other
development documents in the Sybase Unwired Platform documentation set.
Check the Sybase Product Documentation Web site regularly for updates: http://
infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.pubs.docsetSUP-2.0.0/doc/html/title.html.
Tutorials
Try out some of the other getting started tutorials to get a broad view of the development tools
available to you.
Samples
Sample applications are fully developed, working applications that demonstrate the features
and capabilities of Sybase Unwired Platform.
Check the SAP Development Network (SDN) Web site regularly for updates: http://
www.sdn.sap.com/irj/sdn/mobile. Click on Sybase Unwired Platform and navigate to
Samples.
Online Help
See the online help that is installed with the product, or the Product Documentation Web site.
Developer Guides
Learn about using the API to create device applications:
•
•
•
•
Developer Guide for BlackBerry
Developer Guide for iOS
Developer Guide for Mobile Workflow Packages
Developer Guide for Windows and Windows Mobile
Customize and automate:
•
Developer Guide for Unwired Server Management API – customize and automate system
administration features.
•
Developer Guide for Unwired Server – customize and automate server-side
implementations for device applications, and administration, such as data handling.
Javadoc and HeaderDoc are also available in the installation directory.
Mobile Workflow Purchase Order Sample
53
Learn More
Getting Help
Each Sybase installation that has purchased a support contract has one or more designated
people who are authorized to contact Sybase Technical Support.
If you cannot resolve a problem using the online help or other technical documents, have the
designated person contact Sybase Technical Support or the Sybase subsidiary in your area.
54
Sybase Unwired Platform
Index
Index
A
App Store 27
artifacts
reference 51
interface design 15
iTunes 28
J
James Mail Server 9
C
consolidated database
exploring 12
schema 52
consolidated, exploring 12
creating the purchase order 30, 42
D
databases 12
schema 52
deploying to Unwired Server 17
E
e-mail
adding users 9
entity relationships 52
F
features, Unwired Platform 17
Flow Design 15
G
generating
mobile workflow container 26
mobile workflow package
generating 22, 38
H
help, getting 54
I
installing 27
Mobile Workflow Purchase Order Sample
M
MBOs
overview 13
Mobile Application Diagram 13
Mobile Workflow Package Generation Wizard 22,
38
P
prerequisites 5
projects
artifact reference 51
provisioning the device 19
purchase order, creating 30, 42
R
reference
data access layer 52
project artifacts 51
S
sample
learn more 51
schema 52
Screen Design 15
ServerDB, exploring 12
U
Unwired Platform
features demonstrated 17
getting help 54
Technical Support, contacting 54
55
Index
56
Sybase Unwired Platform