use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class BpmnParse method parseStartAuthorization.
protected void parseStartAuthorization(Element scopeElement, ProcessDefinition definition) {
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) definition;
// parse activiti:potentialStarters
Element extentionsElement = scopeElement.element("extensionElements");
if (extentionsElement != null) {
List<Element> potentialStarterElements = extentionsElement.elementsNS(CAMUNDA_BPMN_EXTENSIONS_NS, POTENTIAL_STARTER);
for (Element potentialStarterElement : potentialStarterElements) {
parsePotentialStarterResourceAssignment(potentialStarterElement, processDefinition);
}
}
// parse activiti:candidateStarterUsers
String candidateUsersString = scopeElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, CANDIDATE_STARTER_USERS_EXTENSION);
if (candidateUsersString != null) {
List<String> candidateUsers = parseCommaSeparatedList(candidateUsersString);
for (String candidateUser : candidateUsers) {
processDefinition.addCandidateStarterUserIdExpression(expressionManager.createExpression(candidateUser.trim()));
}
}
// Candidate activiti:candidateStarterGroups
String candidateGroupsString = scopeElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, CANDIDATE_STARTER_GROUPS_EXTENSION);
if (candidateGroupsString != null) {
List<String> candidateGroups = parseCommaSeparatedList(candidateGroupsString);
for (String candidateGroup : candidateGroups) {
processDefinition.addCandidateStarterGroupIdExpression(expressionManager.createExpression(candidateGroup.trim()));
}
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class BpmnParse method parseProcess.
/**
* Parses one process (ie anything inside a <process> element).
*
* @param processElement
* The 'process' element.
* @return The parsed version of the XML: a {@link ProcessDefinitionImpl}
* object.
*/
public ProcessDefinitionEntity parseProcess(Element processElement) {
// reset all mappings that are related to one process definition
sequenceFlows = new HashMap<String, TransitionImpl>();
ProcessDefinitionEntity processDefinition = new ProcessDefinitionEntity();
/*
* Mapping object model - bpmn xml: processDefinition.id -> generated by
* processDefinition.key -> bpmn id (required) processDefinition.name ->
* bpmn name (optional)
*/
processDefinition.setKey(processElement.attribute("id"));
processDefinition.setName(processElement.attribute("name"));
processDefinition.setCategory(rootElement.attribute("targetNamespace"));
processDefinition.setProperty(PROPERTYNAME_DOCUMENTATION, parseDocumentation(processElement));
processDefinition.setTaskDefinitions(new HashMap<String, TaskDefinition>());
processDefinition.setDeploymentId(deployment.getId());
processDefinition.setProperty(PROPERTYNAME_JOB_PRIORITY, parsePriority(processElement, PROPERTYNAME_JOB_PRIORITY));
processDefinition.setProperty(PROPERTYNAME_TASK_PRIORITY, parsePriority(processElement, PROPERTYNAME_TASK_PRIORITY));
processDefinition.setVersionTag(processElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "versionTag"));
try {
String historyTimeToLive = processElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "historyTimeToLive");
processDefinition.setHistoryTimeToLive(ParseUtil.parseHistoryTimeToLive(historyTimeToLive));
} catch (Exception e) {
addError(new BpmnParseException(e.getMessage(), processElement, e));
}
LOG.parsingElement("process", processDefinition.getKey());
parseScope(processElement, processDefinition);
// Parse any laneSets defined for this process
parseLaneSets(processElement, processDefinition);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseProcess(processElement, processDefinition);
}
// now we have parsed anything we can validate some stuff
validateActivities(processDefinition.getActivities());
// unregister delegates
for (ActivityImpl activity : processDefinition.getActivities()) {
activity.setDelegateAsyncAfterUpdate(null);
activity.setDelegateAsyncBeforeUpdate(null);
}
return processDefinition;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class CaseExecutionEntity method createSubProcessInstance.
public ExecutionEntity createSubProcessInstance(PvmProcessDefinition processDefinition, String businessKey, String caseInstanceId) {
ExecutionEntity subProcessInstance = (ExecutionEntity) processDefinition.createProcessInstance(businessKey, caseInstanceId);
// inherit the tenant-id from the process definition
String tenantId = ((ProcessDefinitionEntity) processDefinition).getTenantId();
if (tenantId != null) {
subProcessInstance.setTenantId(tenantId);
} else {
// if process definition has no tenant id, inherit this case instance's tenant id
subProcessInstance.setTenantId(this.tenantId);
}
// manage bidirectional super-subprocess relation
subProcessInstance.setSuperCaseExecution(this);
setSubProcessInstance(subProcessInstance);
fireHistoricCaseActivityInstanceUpdate();
return subProcessInstance;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class DefaultConditionHandler method evaluateConditionStartByProcessDefinitionId.
protected List<ConditionHandlerResult> evaluateConditionStartByProcessDefinitionId(CommandContext commandContext, ConditionSet conditionSet, String processDefinitionId) {
DeploymentCache deploymentCache = commandContext.getProcessEngineConfiguration().getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
List<ConditionHandlerResult> results = new ArrayList<ConditionHandlerResult>();
if (processDefinition != null && !processDefinition.isSuspended()) {
List<ActivityImpl> activities = findConditionalStartEventActivities(processDefinition);
if (activities.isEmpty()) {
throw LOG.exceptionWhenEvaluatingConditionalStartEventByProcessDefinition(processDefinitionId);
}
for (ActivityImpl activity : activities) {
if (evaluateCondition(conditionSet, activity)) {
results.add(new ConditionHandlerResult(processDefinition, activity));
}
}
}
return results;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class BpmnDeploymentTest method testDiagramCreationDisabled.
public void testDiagramCreationDisabled() {
repositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/bpmn/parse/BpmnParseTest.testParseDiagramInterchangeElements.bpmn20.xml").deploy();
// Graphical information is not yet exposed publicly, so we need to do some plumbing
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
ProcessDefinitionEntity processDefinitionEntity = commandExecutor.execute(new Command<ProcessDefinitionEntity>() {
@Override
public ProcessDefinitionEntity execute(CommandContext commandContext) {
return Context.getProcessEngineConfiguration().getDeploymentCache().findDeployedLatestProcessDefinitionByKey("myProcess");
}
});
assertNotNull(processDefinitionEntity);
assertEquals(7, processDefinitionEntity.getActivities().size());
// Check that no diagram has been created
List<String> resourceNames = repositoryService.getDeploymentResourceNames(processDefinitionEntity.getDeploymentId());
assertEquals(1, resourceNames.size());
repositoryService.deleteDeployment(repositoryService.createDeploymentQuery().singleResult().getId(), true);
}
Aggregations