use of org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment in project carbon-business-process by wso2.
the class BPMNDeploymentService method getDeployments.
public BPMNDeployment[] getDeployments() {
List<BPMNDeployment> bpmnDeploymentList = new ArrayList<>();
Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
DeploymentQuery query = BPMNServerHolder.getInstance().getEngine().getRepositoryService().createDeploymentQuery();
query = query.deploymentTenantId(tenantId.toString());
List<Deployment> deployments = query.list();
for (Deployment deployment : deployments) {
BPMNDeployment bpmnDeployment = new BPMNDeployment();
bpmnDeployment.setDeploymentId(deployment.getId());
bpmnDeployment.setDeploymentName(deployment.getName());
bpmnDeployment.setDeploymentTime(deployment.getDeploymentTime());
bpmnDeploymentList.add(bpmnDeployment);
}
return bpmnDeploymentList.toArray(new BPMNDeployment[bpmnDeploymentList.size()]);
}
use of org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment in project carbon-business-process by wso2.
the class BPMNDeploymentService method getDeploymentsByName.
/**
* Get the deployments for given package name , order by deploymentID
*
* @param deploymentName
* @return
*/
public BPMNDeployment[] getDeploymentsByName(String deploymentName) {
List<BPMNDeployment> bpmnDeploymentList = new ArrayList<>();
Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
DeploymentQuery query = BPMNServerHolder.getInstance().getEngine().getRepositoryService().createDeploymentQuery();
// Set deployment name and order by ID
query = query.deploymentTenantId(tenantId.toString()).deploymentName(deploymentName).orderByDeploymentId().desc();
List<Deployment> deployments = query.list();
for (Deployment deployment : deployments) {
BPMNDeployment bpmnDeployment = new BPMNDeployment();
bpmnDeployment.setDeploymentId(deployment.getId());
bpmnDeployment.setDeploymentName(deployment.getName());
bpmnDeployment.setDeploymentTime(deployment.getDeploymentTime());
bpmnDeploymentList.add(bpmnDeployment);
}
return bpmnDeploymentList.toArray(new BPMNDeployment[bpmnDeploymentList.size()]);
}
use of org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment in project carbon-business-process by wso2.
the class BPMNDeploymentService method getPaginatedDeploymentsByFilter.
public BPMNDeployment[] getPaginatedDeploymentsByFilter(String method, String filter, int start, int size) {
List<BPMNDeployment> bpmnDeploymentList = new ArrayList<>();
Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
DeploymentQuery query = BPMNServerHolder.getInstance().getEngine().getRepositoryService().createDeploymentQuery();
query = query.deploymentTenantId(tenantId.toString());
if (filter != null && !filter.equals("") && method != null && !method.equals("")) {
if (method.equals("byDeploymentNameLike")) {
query = query.deploymentNameLike("%" + filter + "%");
} else {
query = query.processDefinitionKeyLike("%" + filter + "%");
}
}
deploymentCount = (int) query.count();
List<Deployment> deployments = query.listPage(start, size);
for (Deployment deployment : deployments) {
BPMNDeployment bpmnDeployment = new BPMNDeployment();
bpmnDeployment.setDeploymentId(deployment.getId());
bpmnDeployment.setDeploymentName(deployment.getName());
bpmnDeployment.setDeploymentTime(deployment.getDeploymentTime());
bpmnDeploymentList.add(bpmnDeployment);
}
return bpmnDeploymentList.toArray(new BPMNDeployment[bpmnDeploymentList.size()]);
}
Aggregations