Search in sources :

Example 1 with BPMNDeployment

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()]);
}
Also used : 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) BPMNDeployment(org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment)

Example 2 with BPMNDeployment

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()]);
}
Also used : 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) BPMNDeployment(org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment)

Example 3 with BPMNDeployment

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()]);
}
Also used : 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) BPMNDeployment(org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment)

Aggregations

ArrayList (java.util.ArrayList)3 Deployment (org.activiti.engine.repository.Deployment)3 DeploymentQuery (org.activiti.engine.repository.DeploymentQuery)3 BPMNDeployment (org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment)3