Search in sources :

Example 1 with BPMNProcess

use of org.wso2.carbon.bpmn.core.mgt.model.BPMNProcess in project carbon-business-process by wso2.

the class BPMNDeploymentService method getProcessById.

public BPMNProcess getProcessById(String processId) {
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    ProcessEngine engine = BPMNServerHolder.getInstance().getEngine();
    ProcessDefinitionQuery query = engine.getRepositoryService().createProcessDefinitionQuery();
    ProcessDefinition process = query.processDefinitionTenantId(tenantId.toString()).processDefinitionId(processId).singleResult();
    DeploymentQuery deploymentQuery = engine.getRepositoryService().createDeploymentQuery();
    Deployment deployment = deploymentQuery.deploymentId(process.getDeploymentId()).singleResult();
    BPMNProcess bpmnProcess = new BPMNProcess();
    bpmnProcess.setDeploymentId(process.getDeploymentId());
    bpmnProcess.setName(process.getName());
    bpmnProcess.setKey(process.getKey());
    bpmnProcess.setProcessId(process.getId());
    bpmnProcess.setVersion(process.getVersion());
    bpmnProcess.setDeploymentTime(deployment.getDeploymentTime());
    bpmnProcess.setDeploymentName(deployment.getName());
    return bpmnProcess;
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery) BPMNProcess(org.wso2.carbon.bpmn.core.mgt.model.BPMNProcess) BPMNDeployment(org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment) Deployment(org.activiti.engine.repository.Deployment) ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition) ProcessEngine(org.activiti.engine.ProcessEngine)

Example 2 with BPMNProcess

use of org.wso2.carbon.bpmn.core.mgt.model.BPMNProcess in project carbon-business-process by wso2.

the class BPMNDeploymentService method getDeployedProcesses.

public BPMNProcess[] getDeployedProcesses() throws BPSFault {
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    TenantRepository tenantRepository = BPMNServerHolder.getInstance().getTenantManager().getTenantRepository(tenantId);
    List<ProcessDefinition> processDefinitions = tenantRepository.getDeployedProcessDefinitions();
    BPMNProcess[] bpmnProcesses = new BPMNProcess[processDefinitions.size()];
    for (int i = 0; i < processDefinitions.size(); i++) {
        ProcessDefinition def = processDefinitions.get(i);
        BPMNProcess bpmnProcess = new BPMNProcess();
        bpmnProcess.setProcessId(def.getId());
        bpmnProcess.setDeploymentId(def.getDeploymentId());
        bpmnProcess.setKey(def.getKey());
        bpmnProcess.setVersion(def.getVersion());
        bpmnProcesses[i] = bpmnProcess;
    }
    return bpmnProcesses;
}
Also used : BPMNProcess(org.wso2.carbon.bpmn.core.mgt.model.BPMNProcess) TenantRepository(org.wso2.carbon.bpmn.core.deployment.TenantRepository) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition)

Example 3 with BPMNProcess

use of org.wso2.carbon.bpmn.core.mgt.model.BPMNProcess in project carbon-business-process by wso2.

the class BPMNDeploymentService method getProcessesByDeploymentId.

public BPMNProcess[] getProcessesByDeploymentId(String deploymentId) {
    List<BPMNProcess> bpmnProcesses = new ArrayList<>();
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    ProcessEngine engine = BPMNServerHolder.getInstance().getEngine();
    ProcessDefinitionQuery query = engine.getRepositoryService().createProcessDefinitionQuery();
    DeploymentQuery deploymentQuery = engine.getRepositoryService().createDeploymentQuery();
    Deployment deployment = deploymentQuery.deploymentId(deploymentId).singleResult();
    List<ProcessDefinition> processes = query.processDefinitionTenantId(tenantId.toString()).deploymentId(deploymentId).list();
    for (ProcessDefinition process : processes) {
        BPMNProcess bpmnProcess = new BPMNProcess();
        bpmnProcess.setDeploymentId(process.getDeploymentId());
        bpmnProcess.setName(process.getName());
        bpmnProcess.setKey(process.getKey());
        bpmnProcess.setProcessId(process.getId());
        bpmnProcess.setVersion(process.getVersion());
        bpmnProcess.setDeploymentTime(deployment.getDeploymentTime());
        bpmnProcess.setDeploymentName(deployment.getName());
        bpmnProcesses.add(bpmnProcess);
    }
    return bpmnProcesses.toArray(new BPMNProcess[bpmnProcesses.size()]);
}
Also used : BPMNProcess(org.wso2.carbon.bpmn.core.mgt.model.BPMNProcess) DeploymentQuery(org.activiti.engine.repository.DeploymentQuery) ArrayList(java.util.ArrayList) BPMNDeployment(org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment) Deployment(org.activiti.engine.repository.Deployment) ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition) ProcessEngine(org.activiti.engine.ProcessEngine)

Aggregations

ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)3 BPMNProcess (org.wso2.carbon.bpmn.core.mgt.model.BPMNProcess)3 ProcessEngine (org.activiti.engine.ProcessEngine)2 Deployment (org.activiti.engine.repository.Deployment)2 DeploymentQuery (org.activiti.engine.repository.DeploymentQuery)2 ProcessDefinitionQuery (org.activiti.engine.repository.ProcessDefinitionQuery)2 BPMNDeployment (org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment)2 ArrayList (java.util.ArrayList)1 TenantRepository (org.wso2.carbon.bpmn.core.deployment.TenantRepository)1