Search in sources :

Example 31 with ProcessDefinitionQuery

use of org.activiti.engine.repository.ProcessDefinitionQuery in project Activiti by Activiti.

the class ProcessDefinitionQueryByLatestTest method testQueryByLatestAndName.

public void testQueryByLatestAndName() throws Exception {
    // Deploy
    List<String> xmlFileNameList = Arrays.asList("name_testProcess1_one.bpmn20.xml", "name_testProcess1_two.bpmn20.xml", "name_testProcess2_one.bpmn20.xml");
    List<String> deploymentIdList = deploy(xmlFileNameList);
    // name
    ProcessDefinitionQuery nameQuery = repositoryService.createProcessDefinitionQuery().processDefinitionName("one").latestVersion();
    List<ProcessDefinition> processDefinitions = nameQuery.list();
    assertEquals(1, processDefinitions.size());
    assertEquals(1, processDefinitions.get(0).getVersion());
    assertEquals("testProcess2", processDefinitions.get(0).getKey());
    // nameLike
    ProcessDefinitionQuery nameLikeQuery = repositoryService.createProcessDefinitionQuery().processDefinitionName("one").latestVersion();
    processDefinitions = nameLikeQuery.list();
    assertEquals(1, processDefinitions.size());
    assertEquals(1, processDefinitions.get(0).getVersion());
    assertEquals("testProcess2", processDefinitions.get(0).getKey());
    // Undeploy
    unDeploy(deploymentIdList);
}
Also used : ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition)

Example 32 with ProcessDefinitionQuery

use of org.activiti.engine.repository.ProcessDefinitionQuery in project Activiti by Activiti.

the class ProcessDefinitionQueryEscapeClauseTest method testQueryByCategoryLike.

public void testQueryByCategoryLike() {
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().processDefinitionCategoryLike("%\\_%");
    assertEquals("Examples_", query.singleResult().getCategory());
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
}
Also used : ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery)

Example 33 with ProcessDefinitionQuery

use of org.activiti.engine.repository.ProcessDefinitionQuery in project CzechIdMng by bcvsolutions.

the class DefaultWorkflowProcessDefinitionService method getByName.

/**
 * Find last version process definition by key
 */
@Override
public WorkflowProcessDefinitionDto getByName(String definitionKey) {
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
    query.active();
    query.latestVersion();
    query.processDefinitionKey((String) definitionKey);
    ProcessDefinition result = query.singleResult();
    if (result != null) {
        return toDto(result);
    }
    return null;
}
Also used : ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition)

Example 34 with ProcessDefinitionQuery

use of org.activiti.engine.repository.ProcessDefinitionQuery in project CzechIdMng by bcvsolutions.

the class DefaultWorkflowProcessDefinitionService method get.

/**
 * Find last version process definition by key
 */
@Override
public WorkflowProcessDefinitionDto get(Serializable definitionId, BasePermission... permission) {
    Assert.notNull(definitionId, "Id definition cannot be null");
    Assert.isInstanceOf(String.class, definitionId, "Id definition must be String!");
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
    query.processDefinitionId((String) definitionId);
    ProcessDefinition result = query.singleResult();
    if (result != null) {
        return toDto(result);
    }
    return null;
}
Also used : ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition)

Aggregations

ProcessDefinitionQuery (org.activiti.engine.repository.ProcessDefinitionQuery)34 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)12 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)5 ArrayList (java.util.ArrayList)4 WorkflowProcessDefinitionDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessDefinitionDto)2 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)2 SysBpmnResourceVO (com.netsteadfast.greenstep.vo.SysBpmnResourceVO)1 ResourcesWrapper (eu.bcvsolutions.idm.core.api.rest.domain.ResourcesWrapper)1 WorkflowProcessInstanceDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessInstanceDto)1 HashSet (java.util.HashSet)1 RepositoryService (org.activiti.engine.RepositoryService)1 ProcessDefinitionImpl (org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl)1 DeploymentQuery (org.activiti.engine.repository.DeploymentQuery)1 ProcessInstanceQuery (org.activiti.engine.runtime.ProcessInstanceQuery)1 Task (org.activiti.engine.task.Task)1 Test (org.junit.Test)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1