use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project Activiti by Activiti.
the class AbstractSetProcessDefinitionStateCmd method createTimerForDelayedExecution.
protected void createTimerForDelayedExecution(CommandContext commandContext, List<ProcessDefinitionEntity> processDefinitions) {
for (ProcessDefinitionEntity processDefinition : processDefinitions) {
TimerJobEntity timer = commandContext.getTimerJobEntityManager().create();
timer.setJobType(JobEntity.JOB_TYPE_TIMER);
timer.setProcessDefinitionId(processDefinition.getId());
// Inherit tenant identifier (if applicable)
if (processDefinition.getTenantId() != null) {
timer.setTenantId(processDefinition.getTenantId());
}
timer.setDuedate(executionDate);
timer.setJobHandlerType(getDelayedExecutionJobHandlerType());
timer.setJobHandlerConfiguration(TimerChangeProcessDefinitionSuspensionStateJobHandler.createJobHandlerConfiguration(includeProcessInstances));
commandContext.getJobManager().scheduleTimerJob(timer);
}
}
use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project Activiti by Activiti.
the class DeploymentManager method findDeployedProcessDefinitionByKeyAndVersionAndTenantId.
public ProcessDefinition findDeployedProcessDefinitionByKeyAndVersionAndTenantId(String processDefinitionKey, Integer processDefinitionVersion, String tenantId) {
ProcessDefinition processDefinition = (ProcessDefinitionEntity) processDefinitionEntityManager.findProcessDefinitionByKeyAndVersionAndTenantId(processDefinitionKey, processDefinitionVersion, tenantId);
if (processDefinition == null) {
throw new ActivitiObjectNotFoundException("no processes deployed with key = '" + processDefinitionKey + "' and version = '" + processDefinitionVersion + "'", ProcessDefinition.class);
}
processDefinition = resolveProcessDefinition(processDefinition).getProcessDefinition();
return processDefinition;
}
use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project Activiti by Activiti.
the class Activiti6Test method testProcessDefinitionTagCreated.
/**
* Simple test that checks if all databases have correcly added the process definition tag.
*/
@Test
@org.activiti.engine.test.Deployment(resources = "org/activiti/engine/test/api/v6/Activiti6Test.testOneTaskProcess.bpmn20.xml")
public void testProcessDefinitionTagCreated() {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
assertThat(((ProcessDefinitionEntity) processDefinition).getEngineVersion()).isNull();
}
use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project Activiti by Activiti.
the class BpmnDeploymentHelper method getMostRecentVersionOfProcessDefinition.
/**
* Gets the most recent persisted process definition that matches this one for tenant and key.
* If none is found, returns null. This method assumes that the tenant and key are properly
* set on the process definition entity.
*/
public ProcessDefinitionEntity getMostRecentVersionOfProcessDefinition(ProcessDefinitionEntity processDefinition) {
String key = processDefinition.getKey();
String tenantId = processDefinition.getTenantId();
ProcessDefinitionEntityManager processDefinitionManager = Context.getCommandContext().getProcessEngineConfiguration().getProcessDefinitionEntityManager();
ProcessDefinitionEntity existingDefinition = null;
if (tenantId != null && !tenantId.equals(ProcessEngineConfiguration.NO_TENANT_ID)) {
existingDefinition = processDefinitionManager.findLatestProcessDefinitionByKeyAndTenantId(key, tenantId);
} else {
existingDefinition = processDefinitionManager.findLatestProcessDefinitionByKey(key);
}
return existingDefinition;
}
use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project Activiti by Activiti.
the class ParsedDeploymentBuilder method build.
public ParsedDeployment build() {
List<ProcessDefinitionEntity> processDefinitions = new ArrayList<ProcessDefinitionEntity>();
Map<ProcessDefinitionEntity, BpmnParse> processDefinitionsToBpmnParseMap = new LinkedHashMap<ProcessDefinitionEntity, BpmnParse>();
Map<ProcessDefinitionEntity, ResourceEntity> processDefinitionsToResourceMap = new LinkedHashMap<ProcessDefinitionEntity, ResourceEntity>();
for (ResourceEntity resource : deployment.getResources().values()) {
if (isBpmnResource(resource.getName())) {
log.debug("Processing BPMN resource {}", resource.getName());
BpmnParse parse = createBpmnParseFromResource(resource);
for (ProcessDefinitionEntity processDefinition : parse.getProcessDefinitions()) {
processDefinitions.add(processDefinition);
processDefinitionsToBpmnParseMap.put(processDefinition, parse);
processDefinitionsToResourceMap.put(processDefinition, resource);
}
}
}
return new ParsedDeployment(deployment, processDefinitions, processDefinitionsToBpmnParseMap, processDefinitionsToResourceMap);
}
Aggregations