Build it yourself

This section describes how to specify late binding when a parent process calls a subprocess. To focus just on the essential steps, you can simply import a predefined project that contains several prerequisite steps (create interfaces, business processes, and assembly modules), which are explained in more detail in the "Getting Started" samples.

This section covers how to:

Import the prepared project

To import the module that provides the required artifacts into your workspace, follow these steps:

  1. Download the VersioningPrepare.zip file and save it to a temporary directory.
  2. In WebSphere Integration Developer, click File > Import. The Import window opens.
  3. Select Other > Project Interchange.
  4. Click Next. The Import Project Interchange Contents window opens.
  5. Click Browse next to From zip file.
  6. Browse to the temporary directory. Select VersioningPrepare.zip, and click Open.
  7. Verify your Project location root.
  8. Click Select All.
  9. Click Finish.

Enable the parent process for late binding

In this section, you provide the parent process with the process template name of the subprocess, which will then be used for a dynamic lookup of the currently valid template at runtime.
Note that intentionally the reference partner used in the ApprovalStep is not wired to any target in the assembly editor, as the target will be dynamically selected during runtime. This causes warning CWSCA8015W to appear after the workspace has finished the build operation:

To enable the parent process for late binding, follow these steps:

  1. In the HandleWarrentyClaim project, select the business process HandleClaimProcess.
  2. Right-click and open the business process editor.
  3. Click on the Reference Partner ApprovalProcessIF.
  4. Switch to the Properties view.
  5. Select the Description tab.
  6. In the field Process Template enter ApprovalProcess.
  7. On the toolbar click the Save button to save this change and close the business process editor.

Note: You might still see warning CWSCA8015W which indicates that no wiring (static binding) exists for this reference partner. You can safely ignore this warning because late binding is specified instead.

Enable the subprocess for late binding

In this section, you add an SCA export to the version 1 of the subprocess that is required to call the subprocess across module boundaries.

Follow these steps:

  1. Expand the ApprovalProcessV1 project.
  2. Right-click ApprovalProcessV1 > Assembly Diagram and select Open With > Assembly Editor.
  3. In the Assembly Diagram, right-click ApprovalProcess and select Generate Export > SCA Binding.
  4. On the toolbar click the Save button to save this change and close the assembly editor.

Now, you can either run the version 1 of the business process as described in the Run the Sample chapter, or you can continue creating version 2 of the business process, and then try the different versions later.

Create a new version of the subprocess by copy

In this section, you create version 2 of the subprocess: First you copy version 1 and then you modify the copy to reflect the evolution of the business process.

To copy version 1, follow these steps:

  1. Close all open editors.
  2. In the Business Integration view, right-click ApprovalProcessV1 > Copy.
  3. Right-click on the white space in the Business Integration view and select Paste.
  4. In the Copy Module dialog, change the proposed new name from ApprovalProcessV1_1 to the value ApprovalProcessV2.
  5. Click OK.

Next, we change the Valid From settings that are still identical to the version 1 values. Without this change, this would create a conflict when trying to install both process versions on the server. Follow these steps:

  1. Expand ApprovalProcessV2 > Business Logic > Processes.
  2. Double-click the ApprovalProcess business process to open the business process editor.
  3. Switch to the Properties view and proceed to the Details tab for the process. This displays the Valid From settings.
  4. Uncheck the checkbox with label Select Date (UTC). The Valid From settings are grayed out.
  5. Check the same checkbox again. This refreshes the Valid From settings with the actual time, translated to the UTC format.
  6. Note: You can set the Valid From settings explicitly to define the point in time when the runtime system should start using this process template. Keep in mind that the process template may be invisible before that point in time is reached.

  7. On the toolbar click the Save button .

Now, we modify the business process to reflect the evolution of the process. Follow these steps:

  1. In the business process editor for the ApprovalProcess, right-click the activity ApprovalDecision and select Change Type > Snippet. If you need more details on how to implement Java snippets, refer to the Getting Started > Hello World sample.
  2. Select the snippet activity ApprovalDecision.
  3. Switch to the Properties view and proceed to the Details tab for the snippet activity.
  4. Switch the type of the Snippet activity to Java and add the following Java code:
  5. Approved = new Boolean(Math.random() > 0.6);

  6. Select the other snippet activity ReportStatus.
  7. Switch to the Properties view and proceed to the Details tab for the snippet activity.
  8. Change the version number that is printed out by the the Java code from V1 to V2. The Java code now looks like this:
  9. System.out.println("ApprovalProcess V2: result is "+Approved);

  10. On the toolbar click the Save button and close the business process editor.

Now, you can run versions 1 and 2 of the business process as described in the Run the Sample chapter. Alternatively, you can continue creating version 3 of the business process, and then try all three versions.

Create another version of the subprocess from scratch

In this section, you create version 3 of the subprocess. This new version is required to use the same interface, the same process component name, and the same namespace as version 1. However, we are allowed to vary the execution mode: While versions 1 and 2 were defined as long-running processes, version 3 is defined as microflow.

First, we find out the process component name of the version 1 process. As the version 1 exists in the workspace, follow these steps:

  1. Right-click ApprovalProcessV1 > Assembly Diagram and select Open With > Assembly Editor.
  2. Identify the process component name, circled red in the following screenshot:
  3. The process component name in this sample is ApprovalProcess, record it as you will need it later on.
  4. Close the assembly editor.
  5. Note: By default, the process component name is identical to the process name. However, for the case that these two names differ, it is important to do this lookup in the assembly editor as described here.

Next, we find out the namespace of the version 1 process. Follow these steps:

  1. Expand ApprovalProcessV1 > Business Logic > Processes.
  2. Double-click the ApprovalProcess business process to open the business process editor.
  3. Switch to the Properties view.
  4. The target namespace is visible in the Description tab. In this sample, it is http://ApprovalProcess, record it as you will need it later on.
  5. Close the business process editor.

Next, we create a new project and create access to the library. Follow these steps:

  1. In the Business Integration view, click New > Module.
  2. As Module Name, use ApprovalProcessV3 and click Finish.
  3. Right-click the ApprovalProcessV3 project and select Open Dependency Editor.
  4. In the dependency editor in the Libraries section, click Add and select the ApprovalProcessInterface library.
  5. On the toolbar click the Save button and close the dependency editor.

Next, we create the new version of the business process. Follow these steps:

  1. In the Business Integration view, expand ApprovalProcessV3 > Business Logic.
  2. Right-click Processes > New > Business Process.
  3. In the New Business Process dialog, specify ApprovalProcess as name. By default, this will imply the appropriate process component name in the assembly editor later.
  4. For specifying the Namespace, uncheck the Default checkbox and change the value to http://ApprovalProcess.
  5. Note: Process component name and namespace must be identical to the values used for the version 1 definition, which is why we looked up these values earlier.

  6. Click Next.
  7. Select Microflow as process type.
  8. Click Next.
  9. In the Select an Interface dialog, choose Select an Existing Interface.
  10. Use Browse to select the ApprovalProcessIF interface and the approve operation.
  11. Click Finish. The business process editor opens.
  12. Optionally, you switch to the Properties view and proceed to the Details tab for the process. There, you can inspect the Valid From settings and verify that it contains the current date and time, translated into UTC timezone as you want this version to become valid right away after installation.

Next, we implement two Java snippet activities in the business process. For more details on how to implement Java snippets, refer to the Getting Started > Hello World sample.

Follow these steps:

  1. In the business process editor, add a Snippet activity after the initial Receive activity.
  2. As name for the Java snippet, choose ApprovalDecision.
  3. Switch to the Properties view and proceed to the Details tab for the snippet activity.
  4. Switch the type of the Snippet activity to Java and add the following Java code:
  5. approved = new Boolean(Math.random() > 0.3);

  6. Add another Snippet activity before the final Reply activity.
  7. As name for this Java snippet, choose ReportStatus.
  8. Switch to the Properties view and proceed to the Details tab for the snippet activity.
  9. Switch the type of the Snippet activity to Java and add the following Java code:
  10. System.out.println("ApprovalProcess V3: result is "+approved);

  11. On the toolbar click the Save button and close the business process editor.

Now we are ready to finalize the module in the assembly editor. Follow these steps:

  1. Right-click ApprovalProcessV3 > Assembly Diagram and select Open With > Assembly Editor.
  2. Drag and drop the ApprovalProcess to the ApprovalProcessV3 - Assembly Diagram.
  3. In the Assembly Diagram, verify that the name of the process component is ApprovalProcess.
  4. Right-click ApprovalProcess and select Generate Export > SCA Binding.
  5. On the toolbar click the Save button and close the assembly editor.

Now proceed to the Run the Sample chapter to see how the different versions of the subprocess can coexist on the server.

Refer to the Getting Started > Hello World sample for more details how to deploy the business process to Business Process Server or how to deploy the business process to the server in your integrated test environment.