use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class CaseHandlerTest method testCaseDefinitionKey.
@Test
public void testCaseDefinitionKey() {
// given: a caseDefinition
// when
CaseDefinitionEntity activity = (CaseDefinitionEntity) handler.handleElement(caseDefinition, context);
// then
assertEquals(caseDefinition.getId(), activity.getKey());
}
use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class CreateCaseInstanceCmd method find.
protected CaseDefinitionEntity find(CommandContext commandContext) {
DeploymentCache deploymentCache = commandContext.getProcessEngineConfiguration().getDeploymentCache();
// Find the case definition
CaseDefinitionEntity caseDefinition = null;
if (caseDefinitionId != null) {
caseDefinition = findById(deploymentCache, caseDefinitionId);
ensureNotNull(CaseDefinitionNotFoundException.class, "No case definition found for id = '" + caseDefinitionId + "'", "caseDefinition", caseDefinition);
} else {
caseDefinition = findByKey(deploymentCache, caseDefinitionKey);
ensureNotNull(CaseDefinitionNotFoundException.class, "No case definition found for key '" + caseDefinitionKey + "'", "caseDefinition", caseDefinition);
}
return caseDefinition;
}
use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class CreateCaseInstanceCmd method execute.
public CaseInstance execute(CommandContext commandContext) {
ensureAtLeastOneNotNull("caseDefinitionId and caseDefinitionKey are null", caseDefinitionId, caseDefinitionKey);
CaseDefinitionEntity caseDefinition = find(commandContext);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkCreateCaseInstance(caseDefinition);
}
// Start the case instance
CaseExecutionEntity caseInstance = (CaseExecutionEntity) caseDefinition.createCaseInstance(businessKey);
caseInstance.create(variables);
return caseInstance;
}
use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class HumanTaskItemHandler method initializeActivity.
@Override
protected void initializeActivity(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
// execute standard initialization
super.initializeActivity(element, activity, context);
// create a taskDefinition
TaskDefinition taskDefinition = createTaskDefinition(element, context);
// get the caseDefinition...
CaseDefinitionEntity caseDefinition = (CaseDefinitionEntity) context.getCaseDefinition();
// ... and taskDefinition to caseDefinition
caseDefinition.getTaskDefinitions().put(taskDefinition.getKey(), taskDefinition);
ExpressionManager expressionManager = context.getExpressionManager();
// create decorator
TaskDecorator taskDecorator = new TaskDecorator(taskDefinition, expressionManager);
// set taskDecorator on behavior
HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
behavior.setTaskDecorator(taskDecorator);
// task listeners
initializeTaskListeners(element, activity, context, taskDefinition);
}
use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class GetDeploymentCmmnModelInstanceCmd method execute.
public CmmnModelInstance execute(CommandContext commandContext) {
ensureNotNull("caseDefinitionId", caseDefinitionId);
ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
final DeploymentCache deploymentCache = configuration.getDeploymentCache();
CaseDefinitionEntity caseDefinition = deploymentCache.findDeployedCaseDefinitionById(caseDefinitionId);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadCaseDefinition(caseDefinition);
}
CmmnModelInstance modelInstance = Context.getProcessEngineConfiguration().getDeploymentCache().findCmmnModelInstanceForCaseDefinition(caseDefinitionId);
ensureNotNull(CmmnModelInstanceNotFoundException.class, "No CMMN model instance found for case definition id " + caseDefinitionId, "modelInstance", modelInstance);
return modelInstance;
}
Aggregations