Show Table of Contents
15.3. Case Management in JBoss BPM Suite
JBoss BPM Suite provides a new wrapper API called
casemgmt that focuses on exposing the Case Management concepts. These explain how Case Management can be mapped with the existing constructs inside JBoss BPM Suite:
Case DefinitionA case definition is a very flexible high level process synonymous to the Ad-Hoc process in JBoss BPM Suite. You can define a default empty Ad-Hoc process for maximum flexibility to use when loaded inRuntimeManager. For a more complex case definition, you can define an Ad-Hoc process that may include milestones, predefined tasks to be accomplished and case roles to specify the roles of case participants.Case InstanceIn an Ad-Hoc process definition, a case instance is created that allows the involved roles to create new tasks. You can create a new case instance for an empty case as below:ProcessInstance processInstance = caseMgmtService.startNewCase("CaseName");During the start of a new case, the parameter 'Case Name' is set as a process variable 'name'.Alternatively, you can create a case instance the same way as new process instance:ProcessInstance processInstance = runtimeEngine.getKieSession().startProcess("CaseUserTask", params);Case FileA case file contains all the information required for managing a case. A case file comprises several case file items each representing a piece of information.Case ContextCase context is the audit and related information about a case execution. A case context can be identified based on the unique case id. TheCaseMgmtUtilclass is used to get active tasks, subprocesses, and nodes. TheAuditServiceclass is used to get a list of passed nodes, and anything that is possible to do with processes. And thegetCaseData()andsetCaseData()of case file are used to get and set thedynamicprocess variables.MilestonesYou can define milestones in a case definition and track a cases progress at runtime. A number of events can be captured from processes and tasks executions. Based on these events, you can define milestones in a case definition and track a case's progress at runtime. ThegetAchievedMilestones()is used to get all achieved milestones. The task names of milestones must beMilestone.Case RoleYou can define roles for a case definition and keep track of which users participate with the case in which role at runtime. Case roles are defined in the case definitions as below:<extensionElements> <tns:metaData name="customCaseRoles"> <tns:metaValue> responsible:1,accountable,consulted,informed </tns:metaValue> </tns:metaData> <tns:metaData name="customDescription"> <tns:metaValue> #{name} </tns:metaValue> </tns:metaData> </extensionElements>The number represents the maximum of users in this role. In the example above, only one user is assigned to role responsible. You can add users to case roles as follows:caseMgmtService.addUserToRole(caseId, "responsible", responsiblePerson);
The case roles cannot be used as groups for Human Tasks. The Human Task has to be assigned to some user with the case role, hence a user is selected in the case role based on some heuristics (random):public String getRandomUserInTheRole(long pid, String role) { String[] users = caseMgmtService.getCaseRoleInstanceNames(pid).get(role); Random rand = new Random(); int n = 0; if (users.length > 1) { n = rand.nextInt(users.length - 1); } return users[n]; }Dynamic NodesThis involves creating dynamic process task, human task, and case task.Human Task: The Human Task service inside JBoss BPM Suite that implements the WS-HumanTask specification (defined by the OASIS group) already provides this functionality and can be fully integrate with. This service takes care of the task lifecycle and allows you to access the internal task events.Process Task: You can use normal process definitions and instances to be executed as part of a case by correlating them with the case ID.Case Task: Just like how you can provide business processes to be executed from another process, you can provide the same feature for executing cases from inside another case.Work Task: The work task with defined work item handler.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.