Mobile business process management, Part 1: Extending BPM processes to mobile workers

Building a mobile app that's integral to a business process

This article describes how to expose human tasks to remote mobile business users in a process authored using IBM® Business Process Manager 7.5.1. Using the Android SDK and the IBM Business Process Manager REST APIs, you will see how you can create an Android business process management (BPM) task list application that enables mobile users to see, claim, and complete the tasks assigned to them. This content is part of the IBM Business Process Management Journal.

Paul Pacholski (pacholsk@ca.ibm.com), Technical Sales Lead, IBM

Paul Pacholski has been working with IBM for 29 years. First as senior developer at the IBM Canada Laboratory an currently as BPM Technical Sales Leader he is responsible for technical enablement within IBM, helping customers with selecting the BPM tools and runtimes, presenting at technical conferences, publishing technical papers and filing patents and inventions related to BPM.



Anders Rawlins (arawlins@ca.ibm.com), Advisory Software Developer, IBM China

Anders Rawlins has been working with IBM for 11 years. He is currently an Advisory Software Developer for IBM Integration Designer and IBM Process Designer at the IBM Toronto Lab.



15 February 2012

Introduction

Mobile technologies provide real-time access to business process management (BPM) processes from remote locations. By extending existing processes to mobile workers, enterprises can significantly improve business responsiveness, increase worker productivity, and improve processing times.

This article — the first in a series on mobile BPM — describes how to build a simple “Hello World” task list mobile application for use by mobile workers who interact with BPM processes.

The first part of this article explores a completed BPM mobile solution to give you an understanding of how remote mobile workers could interact with a process instance via a mobile task list application running on an Android mobile device. The second part of the article provides the steps to develop the application described, including testing and deployment, to give you a foundation for building your own mobile task list app for processes you have implemented using IBM Business Process Manager 7.5.1.


Solution overview

The business scenario used in this example is insurance claims handling. For the purpose of this article, the insurance claim process scenario used here (Figure 1) is very simple (and is not meant to illustrate best practices of claims handling).

Figure 1. Claim processing process with Mobile swim lane
Figure 1. Claim processing process with Mobile swim lane

The process has two human task swim lanes:

  • The Office swim lane has two users defined (Figure 2). All tasks in that swim lane will be assigned automatically to one of these users on a round robin basis.
    Figure 2. Tasks in the Office swim lane are assigned to cpOffice Group
    Figure 2. Tasks in the Office swim lane are assigned to cpOffice Group
  • Similarly, the Mobile swim lane also has two users (Figure 3).
    Figure 3. Tasks in the Mobile swim lane are assigned to cpMobile Group
    Figure 3. Tasks in the Mobile swim lane are assigned to cpMobile Group

In Figure 1, notice the link from the More Information Needed BPMN (Business Process Modeling Notation) decision primitive to the Request Field Information human activity (marked 1 in the figure). Since the office-based Claims Examiners have no real-time access to remote locations, they can request the filed information needed to process a claim from a remote mobile Claims Examiner and get the results back instantly.

Notice the link between from the Request Field Information human task to the Manual Processing human task (marked 2 in Figure 1). When the mobile worker completes the task, the request field information flows back to the office-based Claims Examiner. Since the information is supplied via the process, it becomes a permanent part of the process instance: it is time-stamped, signed, and authenticated, and can be tracked and audited.

Finally, notice that the pattern of requesting field information by the office-based Claims Examiner from the mobile Claims Examiner can be repeated until the office-based Claims Examiner has sufficient information to make a decision.

A day in the life of Claims Examiners

Let’s see how an office-based Claims Examiner (Bernard – cpOfficeUser1) and a mobile Claims Examiner (Paul – cpMobileUser2) collaborate to complete a claim:

  1. Bernard logs in to the Process Portal as cpOfficeUser1 (Figure 4).
    Figure 4. Office-based Claims Examiner logs into Process Portal
    Figure 4. Office-based Claims Examiner logs into Process Portal
    Since Bernard’s user ID is part of cpOffice group (Figure 2), which is associated with the Office swim lane, he finds several tasks in his task list (Figure 5). Notice the tasks are for the Manual Processing process step in the Office swim lane (Figure 1).
  2. Bernard decides to work on task highlighted in Figure 5. He clicks the green arrow next to the last task in the Run column.
    Figure 5. Office-based Claims Examiner claims his task
    Figure 5. Office-based Claims Examiner claims his task
  3. While reviewing the task, Bernard realizes that he needs some information from a mobile Claims Examiner. He clicks the ADD QUESTION button (Figure 6).
    Figure 6. Office-based Claims Examiner needs filed information
    Figure 6. Office-based Claims Examiner needs filed information
    Bernard types his question, What is odometer value? and clicks the GET MORE INFORMATION button. Notice that the date, time, and user fields are filled in automatically and are read only (Figure 7). The time stamp and user ID are added automatically for auditing purposes.
    Figure 7. Office-based Claims Examiner forwards the request to a Mobile Claims Examiner
    Figure 7. Office-based Claims Examiner forwards the request to a Mobile Claims Examiner
    Figure 8 shows the diagram of this process instance. Notice that because Bernard requested more information form a mobile Claims Examiner, the next task to be executed is now in the Mobile swim lane.
    Figure 8. The next task instance is Request Field Information in the Mobile swim lane
    Figure 8. The next task instance is Request Field Information in the Mobile swim lane
  4. From his mobile device (in this case, an Android tablet) Paul (mobile user cpMobileUser2 , see Figure 3) launches his Mobile Claims application (Figure 9).
    Figure 9. Mobile Task List application
    Figure 9. Mobile Task List application
    Because the security credentials are already preconfigured for Paul in the Mobile Claims application (discussed later), Paul does not need to login again and he immediately sees his task list (Figure 10).
  5. Paul selects task 189, which is the task that originated above in step 3 by Bernard, the office-based Claims Examiner. Recall that Bernard needed to know the odometer reading.
    Figure 10. Task in the Mobile Task List application
    Figure 10. Task in the Mobile Task List application
  6. Paul sees the question from Bernard (cpOfficeUser1) and clicks the ADD REPLY button (Figure 11).
    Figure 11. Request Field Data Task user interface rendered on mobile device
    Figure 11. Request Field Data Task user interace rendered on mobile device
  7. Paul types the answer to Bernard’s questions and clicks the SUBMIT button (Figure 12).
    Figure 12. Completion of Mobile Task
    Figure 12. Completion of Mobile Task
    Figure 13 shows the process diagram of this process instance. Notice that because Paul completed his task with the answer to Bernard’s question, the next task to be executed is now in the Office swim lane. Actually, the task assignment was not left to chance. The task was assigned to the previous task owner in the Office swim lane (Bernard - cpOfficeUser1) rather than to any user in the swim lane.
    Figure 13. The next task instance is Manual Processing in the Office swim lane
    Figure 13. The next task instance is Manual Processing in the Office swim lane
  8. Bernard looks at his task list and discovers that task 189 that is now again assigned to him (Figure 14). Bernard clicks the green arrow to work on the task.
    Figure 14. Task 189 is ready for approval
    Figure 14. Task 189 is ready for approval
    He sees Paul’s answer. Based the new information provided by Paul, he decides to approve the task, and then clicks the COMPLETE button to conclude it (Figure 15).
    Figure 15. Task 189 is completed
    Figure 15. Task 189 is completed
    The next task to be performed is now the Notify Customer task (Figure 16).
    Figure 16. Claim processing completed
    Figure 16. Claim processing completed

The steps above describe how the mobile task list Android application can be used in the Claims Process. The remainder of this article explains how you can build and experiment with this sample mobile application.


Creating an Android task list application

Assumptions

The primary purpose of the app presented here is to describe how a mobile application can interact with Business Process Manager, rather than showcase the Android platform. These steps assume general familiarity with Business Process Manager, mobile app development, Eclipse, Android development components, and related tools.

The remainder of this article describes the steps involved in creating the task list application for the Android platform introduced in the previous section. Android 2.2 (Froyo) (see Resources) is used for this example, as this version (and later) covers most active Android devices. The sample Android application will interact with the Business Process Manager runtime using IBM Business Process Manager 7.5.1 REST APIs to query and invoke tasks for a mobile business user. For simplicity, the default Android widgets and layouts are used.

The major steps to create this sample app include:

  1. Install the Android SDK
  2. Create an Android project
  3. Create an activity to view tasks
  4. Create an activity to view coaches
  5. Link the two activities together
  6. Create a virtual device and test the application

1. Install the Android SDK

Installing the Android SDK involves installing the SDK starter package, installing the Eclipse ADT plugin, and adding the desired platforms and components (Figure 17). (See Resources to download these components.)

  1. Download an Eclipse IDE (the “Eclipse Classic” version is recommended) if you don't already have one.
  2. Download and install the SDK starter package for your system.
  3. Download the eclipse ADT plug.
  4. Add the Android 2.2 platform and recommended components by launching the Android SDK Manager from within Eclipse.
    Figure 17. Recommended components
    Figure 17. Recommended components

2. Create an Android project

An Android project is very similar to an Eclipse Java™ project; it's a container for your classes and other Android resources.

  1. In Eclipse, create an Android project by navigating to File > New > other > Android > Android Project. Enter a name, such as HelloBPMWorld, and click Next.
  2. Select Android 2.2 under Build Target and click Next (Figure 18).
    Figure 18. Build Target
    Figure 18. Build Target
  3. For Application Name, enter Mobile Claims. For Package Name, enter hello.bpm.world, and enter TasksActivity in the Create Activity field (Figure 19). Click Finish.
    Figure 19. Application Info
    Figure 19. Application Info

3. Create an activity to view tasks

Sample code

The code for the sample application presented here is included with this article for download.

An activity provides a GUI panel with which users can interact for the purpose of doing some specific thing. You will use the REST API from Business Process Manager to get the tasks and create a ListActivity to display them. You will use the search component of the REST API (Figure 20). (See Using the REST APIs in IBM Business Manager 7.5 for details about the APIs.)

Figure 20. REST Search API
Figure 20. REST Search API
  1. You've already created the activity in the New Android Project wizard; however, it extends the wrong super class. Open TasksActivity.java and change the super class from Activity to ListActivity. ListActivity provides default content (a list) so remove the setContentView(R.layout.main) method call from the onCreate method (Figure 21).
    Figure 21. ListActivity
    Figure 21. ListActivity
  2. Use a SimpleCursorAdapter as the ListAdapter to provide the contents of the list (Figure 22). Table A describes key elements of this code.
    Figure 22. Using ListAdapter
    Figure 22. Using ListAdapter
    Table A. Key elements of Figure 22
    LineDescription
    132An adapter for a Cursor object. A cursor object can be used to iterate backward or forward through a data set.
    133simple_list_item_2: An Android layout for a list item that displays two lines of text, one above the other.
    MatrixCursor: A simple Cursor implementation.
    134-135Map the columns in the MatrixCursor to the text fields in the simple_list_item_2 layout.
    136-146Trigger the list view to redraw itself when the dataset changes.
  3. Before setting the list adapter, create a text view to display when the list is empty (Figure 23).
    Figure 23. Create a View for an Empty List
    Figure 23. Create a View for an Empty List
  4. Create an AsyncTask class inside TasksActivity to perform the REST API call. Make sure to override the doInBackground() method (Figure 24 and Table B).
    Figure 24. Create an AsyncTask
    Figure 24. Create an AsyncTask
    Table B. Key elements of Figure 24
    LineDescription
    27This AsyncTask accepts a string as input (the query string) and a string for updating the UI (not used in this example), and returns a JSONObject, the result of the API call.
    29The base path for the REST search API.
  5. Before implementing the doInBackground() method, add some constants to TasksActivity for server connection information (Figure 25).
    Figure 25. Connection Information
    Figure 25. Connection Information
  6. In doInBackground(), create an HTTP client, set up the credentials, execute an HTTP PUT, and then return the resultant JSON object (Figure 26).
    Figure 26. REST API Call
    Figure 26. REST API Call
  7. You now have an AsyncTask that calls the Business Process Manager REST API in a background thread. You need to update the UI before and after you execute this method. Luckily, AsyncTask provides you with methods to do this. First, override the onPreExecute() method (Figure 27 and Table C).
    Figure 27. Reset List View
    Figure 27. Reset List View
    Table C. Key elements of Figure 27
    LineDescription
    131-132Check to see if the list view already has content.
    135-136Clear the adapter so the list’s empty view (that is, the “loading” text) will be shown.
    137Trigger the list view to update.
  8. Override the onPostExecute() method to update the adapter with the results from doInBackground() (Figure 28 and Table D).
    Figure 28. Update List View
    Figure 28. Update List View
    Table D. Key elements of Figure 28
    LineDescription
    104-105Retrieve the cursor to add the data to.
    107-110If the result of the REST API call contains no data, then update the empty view text and return.
    117-132The first row in each list item will be the task subject concatenated with the task due date. The second row will be the task instance name.
    133Add each task to the cursor in order to display it in the list view.
  9. You now have a complete QueryTask. You need to call it from the onCreate() method. You can also set the title of this activity to something more informative (Figure 29).
    Figure 29. Invoke AsyncTask
    Figure 29. Invoke AsyncTask
  10. Android requires applications to declare which services and hardware they require in order to function. Since QueryTask opens an Internet connection, you need to update the AndroidManifest.xml file that was generated when you created the project. The manifest is where you define your application and the activities and services it provides.
    Figure 30. Android permissions
    Figure 30. Android permissions
    Table E. Key elements of Figure 30
    LineDescription
    3The package is what identifies your app in the Android Market so try and make it unique.
    4The Android Market uses this version code. It needs to be incremented with each release so you can publish an update to your app.
    5This is what is displayed in the Android Market to the user, it can technically be any string. Just be sure to keep the updates consistent.
    7This is the minimum Android OS version on which the app can be installed; 8 is the code for Android 2.2.
    8Gives the app permission to use the Internet.

4. Create an activity to view coaches

Running a task on a desktop computer launches a human service in a browser. You will do something similar in Android, except that instead of launching a web browser you will create another activity that has one widget; a WebView. As the name implies, a WebView is a view that displays web pages.

  1. Create a new class in the hello.bpm.world package called WebviewActivity, and have it extend android.app.Activity.
  2. Override the onCreate() method and create a WebView object (Figure 31).
    Figure 31. Create a WebView
    Figure 31. Create a WebView
  3. Enable JavaScript™ and the zoom controls in the WebView settings (Figure 32).
    Figure 32. WebView Settings
    Figure 32. WebView Settings
  4. Next, create and set the WebChromeClient and the WebViewClient to permit JavaScript alert dialogs and handle authentication, respectively (Figure 33).
    Figure 33. Create WebView Clients
    Figure 33. Create WebView Clients
  5. Finally, get the title and URL to load from the activity’s intent (Figure 34 and Table F).
    Figure 34. Set Title and Load URL
    Figure 34. Set Title and Load URL
    Table F. Key elements of Figure 34
    LineDescription
    71, 75These values will be set by TasksActivity (see next section).
  6. Update the AndroidManifest.xml file to add the new activity (Figure 35).
    Figure 35. Add Webview Activity
    Figure 35. Add Webview Activity

5. Link the two activities together

You have an activity to list the user’s tasks and an activity to display the coach for the task. You will use the Android Intent system to launch one from the other.

  1. In TasksActivity override the onListItemClick() method to invoke the WebviewActivity when the user touches a task in the list (Figure 36 and Table G).
    Figure 36. Launching Webview Activity
    Figure 36. Launching Webview Activity
    Table G. Key elements of Figure 36
    LineDescription
    188-190Retrieve the ID of the task to launch and the string to use as the title of the WebviewActivity.
    194Create the URL to pass into the WebView.
    197Create the Intent that will tell Android what action you want to do (view), the data to pass in (uri) and, in this case, which class to invoke.
    198-200A bundle is essentially a hash map for you to pass in data to the intent that will be accessible from the receiving activity.
    201Start the activity and get notified when the user returns from it. The requestCode can be an arbitrary int, as you’re only launching one activity.
  2. Override onActivityResult() in TasksActivity to refresh the tasks list when the user returns from the WebviewActivity (Figure 37).
    Figure 37. Reload Tasks List
    Figure 37. Reload Tasks List

6. Create a virtual device and test the application

You can test your Android application either on a physical device or on a device simulator. The steps below will help you do both.

  1. Click the toolbar button to open the Android Virtual Device Manager (Figure 38).
    Figure 38. Open AVD Manager
    Figure 38. Open AVD Manager
  2. In the dialog, click the New button to bring up the new AVD button. Fill in the Name field, set the Target to Android 2.2 - API Level 8, and set the SD Card size to 10 MiB. Click Create AVD (Figure 39).
    Figure 39. New AVD
    Figure 39. New AVD
  3. Select the AVD you just created and click the Start button, accepting defaults for the dialogs that pop up.
  4. Wait for the simulator to launch and for the Android home screen to appear. If it starts up with the lock panel, unlock it by sliding the lock icon to the right.
  5. Go back to Eclipse and right click on the HelloBPMWorld project and select Run As > Android Application.

And that’s it! You should see the simulator launch the HelloBPMWorld app and list all of the tasks for the cpMobileUser2 user.

To test this on an actual Android device, close the simulator and attach your phone or tablet to your computer via the USB cable (Windows® users will need to download the USB driver. You need to enable USB debugging on your device via Settings > Applications > Development > USB debugging, then simply launch your project again in Eclipse. It will install the app on your device.


Conclusion

This article introduced a simple “Hello World” mobile application that enables both mobile workers and office-based worker to collaborate in completing a process instance. First, the completed solution was illustrated to show the actual steps and the touch points between mobile and office-based roles in action. Next, you learned how to build the sample mobile application using IBM Business Process Manager 7.5.1 REST API and the Android SDK.

You are now ready to start your Mobile BPM journey!


Downloads

DescriptionNameSize
Sample applicationHelloBPMWorld.zip16 KB
Code sampleSampleAppFiles.zip5 KB

Resources

Learn

Get products and technologies

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Business process management on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Business process management, WebSphere
ArticleID=793893
ArticleTitle=Mobile business process management, Part 1: Extending BPM processes to mobile workers
publish-date=02152012