Skip to content

Instantly share code, notes, and snippets.

@meyerdan
Created July 17, 2014 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meyerdan/44e83b51053add9639e4 to your computer and use it in GitHub Desktop.
Save meyerdan/44e83b51053add9639e4 to your computer and use it in GitHub Desktop.
CMMN Loan Application Example
// deploy the case definition
repositoryService.createDeployment()
.addClasspathResource("org/camunda/bpm/engine/test/examples/cmmn/loan-application.cmmn")
.deploy();
// create a new case instance
CaseInstance caseInstance = caseService
.withCaseDefinitionByKey("loanApplication")
.setVariable("applicantId", "some id ...")
.create();
// as a result, the stage and the tasks are enabled.
// Query for the stage execution
CaseExecution stageExecution = caseService.createCaseExecutionQuery()
.caseInstanceId(caseInstance.getId())
.activityId("PI_Stage_1")
.singleResult();
// start the stage
caseService.withCaseExecution(stageExecution.getId())
.manualStart();
// now the "Review Documents" task is enabled:
CaseExecution reviewDocumentsExecution = caseService.createCaseExecutionQuery()
.activityId("PI_HumanTask_4")
.enabled()
.singleResult();
// start the review documents task:
caseService.withCaseExecution(reviewDocumentsExecution.getId())
.manualStart();
// complete the review documents task:
caseService.withCaseExecution(reviewDocumentsExecution.getId())
.setVariable("allDocumentsObtained", true)
.complete();
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment