Created
July 17, 2014 09:54
-
-
Save meyerdan/44e83b51053add9639e4 to your computer and use it in GitHub Desktop.
CMMN Loan Application Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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