Search in sources :

Example 56 with ProcessDefinitionEntity

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);
    }
}
Also used : ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity) TimerJobEntity(org.activiti.engine.impl.persistence.entity.TimerJobEntity)

Example 57 with ProcessDefinitionEntity

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;
}
Also used : ProcessDefinition(org.activiti.engine.repository.ProcessDefinition) ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException)

Example 58 with ProcessDefinitionEntity

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();
}
Also used : ProcessDefinition(org.activiti.engine.repository.ProcessDefinition) ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity) Test(org.junit.Test)

Example 59 with ProcessDefinitionEntity

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;
}
Also used : ProcessDefinitionEntityManager(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntityManager) ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 60 with ProcessDefinitionEntity

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);
}
Also used : ArrayList(java.util.ArrayList) ResourceEntity(org.activiti.engine.impl.persistence.entity.ResourceEntity) ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity) BpmnParse(org.activiti.engine.impl.bpmn.parser.BpmnParse) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)67 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)12 ActivitiException (org.activiti.engine.ActivitiException)11 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)9 CommandContext (org.activiti.engine.impl.interceptor.CommandContext)8 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)8 BpmnModel (org.activiti.bpmn.model.BpmnModel)7 InputStream (java.io.InputStream)6 ArrayList (java.util.ArrayList)6 RepositoryService (org.activiti.engine.RepositoryService)6 ProcessDefinitionEntityManager (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntityManager)6 StreamResource (com.vaadin.terminal.StreamResource)5 HashMap (java.util.HashMap)5 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)5 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)4 TaskDefinition (org.activiti.engine.impl.task.TaskDefinition)4 Deployment (org.activiti.engine.test.Deployment)4 Embedded (com.vaadin.ui.Embedded)3 Label (com.vaadin.ui.Label)3 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)3