deployment.addDeployedArtifact(caseDefinition);
}
}
protected void persistCaseDefinitions(DeploymentEntity deployment, Collection<CaseDefinitionEntity> caseDefinitions) {
CaseDefinitionManager caseDefinitionManager = Context
.getCommandContext()
.getCaseDefinitionManager();
for (CaseDefinitionEntity caseDefinition : caseDefinitions) {
String deploymentId = deployment.getId();
caseDefinition.setDeploymentId(deploymentId);
String key = caseDefinition.getKey();
CaseDefinitionEntity latestCaseDefinition = caseDefinitionManager.findLatestCaseDefinitionByKey(key);
int version = getNextVersion(caseDefinition, latestCaseDefinition);
caseDefinition.setVersion(version);
String caseDefinitionId = generateCaseDefinitionId(caseDefinition);
caseDefinition.setId(caseDefinitionId);
caseDefinitionManager.insertCaseDefinition(caseDefinition);
// Add to cache
addCaseDefinitionToDeploymentCache(caseDefinition);
// Add to deployment for further usage