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);
}
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());
}
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;
}
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;
}
Aggregations