public CaseDefinitionEntity findDeployedLatestCaseDefinitionByKey(String caseDefinitionKey) {
ensureNotNull("Invalid case definition key", "caseDefinitionKey", caseDefinitionKey);
// load case definition by key from db
CaseDefinitionEntity caseDefinition = Context
.getCommandContext()
.getCaseDefinitionManager()
.findLatestCaseDefinitionByKey(caseDefinitionKey);
ensureNotNull(CaseDefinitionNotFoundException.class, "no case definition deployed with key '" + caseDefinitionKey + "'", "caseDefinition", caseDefinition);