Search in sources :

Example 16 with ProcessDefinitionQuery

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());
}
Also used : ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery)

Example 17 with ProcessDefinitionQuery

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());
}
Also used : ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery)

Example 18 with ProcessDefinitionQuery

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;
}
Also used : Task(org.activiti.engine.task.Task) SysBpmnResourceVO(com.netsteadfast.greenstep.vo.SysBpmnResourceVO) ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition) ProcessInstance(org.activiti.engine.runtime.ProcessInstance)

Example 19 with ProcessDefinitionQuery

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());
    }
}
Also used : ProcessDefinitionImpl(org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl) ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition) RepositoryService(org.activiti.engine.RepositoryService) Test(org.junit.Test)

Example 20 with ProcessDefinitionQuery

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());
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery)

Aggregations

ProcessDefinitionQuery (org.activiti.engine.repository.ProcessDefinitionQuery)29 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)7 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)5 SysBpmnResourceVO (com.netsteadfast.greenstep.vo.SysBpmnResourceVO)1 ArrayList (java.util.ArrayList)1 RepositoryService (org.activiti.engine.RepositoryService)1 ProcessDefinitionImpl (org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl)1 DeploymentQuery (org.activiti.engine.repository.DeploymentQuery)1 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)1 Task (org.activiti.engine.task.Task)1 Test (org.junit.Test)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1