use of org.activiti.engine.repository.ProcessDefinitionQuery in project Activiti by Activiti.
the class ProcessDefinitionQueryEscapeClauseTest method testQueryByKeyLike.
public void testQueryByKeyLike() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().processDefinitionKeyLike("%\\_%");
assertEquals("two_", query.singleResult().getKey());
assertEquals(1, query.list().size());
assertEquals(1, query.count());
}
use of org.activiti.engine.repository.ProcessDefinitionQuery in project Activiti by Activiti.
the class ProcessDefinitionQueryEscapeClauseTest method testQueryByResourceNameLike.
public void testQueryByResourceNameLike() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().processDefinitionResourceNameLike("%\\%%");
assertEquals("org/activiti/engine/test/repository/one%.bpmn20.xml", query.singleResult().getResourceName());
assertEquals(1, query.list().size());
assertEquals(1, query.count());
query = repositoryService.createProcessDefinitionQuery().processDefinitionResourceNameLike("%\\_%");
assertEquals("org/activiti/engine/test/repository/two_.bpmn20.xml", query.singleResult().getResourceName());
assertEquals(1, query.list().size());
assertEquals(1, query.count());
}
use of org.activiti.engine.repository.ProcessDefinitionQuery in project bamboobsc by billchen198318.
the class BusinessProcessManagementUtils method getTaskDiagramById.
public static byte[] getTaskDiagramById(String resourceId, String taskId) throws Exception {
SysBpmnResourceVO resouce = loadResource(resourceId);
Task task = getTaskById(taskId);
if (null == task) {
return null;
}
ProcessDefinitionQuery pdQuery = repositoryService.createProcessDefinitionQuery().processDefinitionKey(resourceId);
List<ProcessDefinition> pdList = pdQuery.deploymentId(resouce.getDeploymentId()).list();
byte[] data = null;
for (ProcessDefinition pd : pdList) {
List<ProcessInstance> piList = runtimeService.createProcessInstanceQuery().processDefinitionId(pd.getId()).list();
for (ProcessInstance pi : piList) {
if (pi.getProcessInstanceId().equals(task.getProcessInstanceId())) {
data = getDiagramByte(pi);
}
}
}
return data;
}
use of org.activiti.engine.repository.ProcessDefinitionQuery in project bamboobsc by billchen198318.
the class TestBPMN001 method queryProcessDefinition.
@Test
public void queryProcessDefinition() throws Exception {
RepositoryService repositoryService = (RepositoryService) AppContext.getBean("repositoryService");
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
List<ProcessDefinition> processDefs = processDefinitionQuery.processDefinitionKey("Employee360DegreeFeedbackProjectPublishProcess").orderByProcessDefinitionVersion().desc().list();
for (ProcessDefinition pd : processDefs) {
System.out.println(pd.getId() + " , " + pd.getName() + " , " + pd.getKey() + " , " + pd.getVersion());
ProcessDefinitionImpl pdObj = (ProcessDefinitionImpl) repositoryService.getProcessDefinition(pd.getId());
System.out.println(pdObj.getActivities());
}
}
use of org.activiti.engine.repository.ProcessDefinitionQuery in project Activiti by Activiti.
the class SpringAutoDeployTest method testNoRedeploymentForSpringContainerRestart.
public void testNoRedeploymentForSpringContainerRestart() throws Exception {
createAppContext(CTX_PATH);
DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
assertEquals(1, deploymentQuery.count());
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
assertEquals(3, processDefinitionQuery.count());
// Creating a new app context with same resources doesn't lead to more
// deployments
new ClassPathXmlApplicationContext(CTX_NO_DROP_PATH);
assertEquals(1, deploymentQuery.count());
assertEquals(3, processDefinitionQuery.count());
}
Aggregations