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