Tuesday, December 10, 2013

Create a custom Case Activity in Oracle BPM Case Management

In one of my previous posts I highlighted the new case management functionalites in Oracle BPM Suite. Case management enables you to define the different activities - a user can perform to achieve a goal - without defining the workflow process. For more details about ACM I recommend to download our "Adaptive Case Management in Practice" poster and to read the following articles:


A case is always associated with activities which are performed as part of a particular case. Among milestones, data, events, stakeholders and documents the activities are a key element in Oracle BPM 11g Case Management. In the current release you can create case activities based on a BPM process, or a Human Task, or you can create a custom case activity based on a Java class. In this post I will explain the steps to create a custom case activity.

Create a Custom Case Activity


1. Create a new "BPM Application"
2. Create a new "BPM Project"
3. Create a "Composite with Case Management" component

The above steps will result in a composite with the case and its exposed service and case rules. Now you can open the case definition and define your milestones, stakeholders, permissions, data, user events and so on. See the step-by-step "Hello World" example for more details. The Custom Activity Java class must implement the oracle.bpm.casemgmt.caseactivity.ICaseActivityCallback interface. The callback class must be part of the composite (as explained below), or must add it to the workflow customization classpath.

4. Import the oracle.bpm.casemgmt.interface.jar from
<MW_HOME>/Oracle_SOA1/soa/modules/oracle.bpm.runtime_11.1.1/


5. Import the bpm-services.jar from
<MW_HOME>/Oracle_SOA1/soa/modules/oracle.soa.workflow_11.1.1/

6. Select File => New => Java Class and create the CustomCaseActivity Java class.


7. Organize imports and add your custom logic in the "initiate" operation.

package com.cattlecrew.acm.caseactivities;

import java.util.Map;

import oracle.bpm.casemgmt.CaseIdentifier;
import oracle.bpm.casemgmt.caseactivity.ICaseActivityCallback;
import oracle.bpel.services.bpm.common.IBPMContext;

public class CustomCaseActivity implements ICaseActivityCallback {
    public CustomCaseActivity() {
        super();
    }

    public String initiate(IBPMContext iBPMContext,
                           CaseIdentifier caseIdentifier, String string,
                           Map<String, Object> map) {
       
        // Add activity logic here
       
        return "Called class CustomCaseActivity for activity => " + string;
    }
}

8. Create the case activity based on the Java class. See chapter 31 of the Oracle Fusion Middleware Modeling and Implementation Guide for Oracle Business Process Management for more details about config options and guidelines.



9. Define your Business Rules.

10. Deploy and test the Case composite.