当前位置: 首页>>代码示例>>Java>>正文


Java HistoricProcessInstanceQuery.unfinished方法代码示例

本文整理汇总了Java中org.activiti.engine.history.HistoricProcessInstanceQuery.unfinished方法的典型用法代码示例。如果您正苦于以下问题:Java HistoricProcessInstanceQuery.unfinished方法的具体用法?Java HistoricProcessInstanceQuery.unfinished怎么用?Java HistoricProcessInstanceQuery.unfinished使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.history.HistoricProcessInstanceQuery的用法示例。


在下文中一共展示了HistoricProcessInstanceQuery.unfinished方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createHistoricProcessInstanceQuery

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
/**
 * Creates a HistoricProcessInstanceQuery in the given process definitions, optionally filtering by the given job status, start and end times.
 * 
 * @param processDefinitionKeys Collection of process definition keys
 * @param jobStatus The job status. Optional.
 * @param startTime The start time. Optional.
 * @param endTime The end time. Optional.
 * 
 * @return A HistoricProcessInstanceQuery
 */
private HistoricProcessInstanceQuery createHistoricProcessInstanceQuery(Collection<String> processDefinitionKeys, JobStatusEnum jobStatus,
    DateTime startTime, DateTime endTime)
{
    HistoricProcessInstanceQuery query =
        activitiHistoryService.createHistoricProcessInstanceQuery().processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys));

    if (JobStatusEnum.RUNNING.equals(jobStatus) || JobStatusEnum.SUSPENDED.equals(jobStatus))
    {
        // If the filter is for "running" or "suspended", use the "unfinished" query filter.
        query.unfinished();
    }
    else if (JobStatusEnum.COMPLETED.equals(jobStatus))
    {
        // If the filter is for "completed" processes, use the "finished" query filter.
        query.finished();
    }

    if (startTime != null)
    {
        query.startedAfter(startTime.toDate());
    }

    if (endTime != null)
    {
        query.finishedBefore(endTime.toDate());
    }
    return query;
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:39,代码来源:ActivitiServiceImpl.java

示例2: getProcessInstances

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
@Get
public DataResponse getProcessInstances() {
  if(authenticate() == false) return null;
  
  HistoricProcessInstanceQuery query = ActivitiUtil.getHistoryService().createHistoricProcessInstanceQuery();
  query = query.unfinished();
  String processDefinitionId = getQuery().getValues("processDefinitionId");
  String processInstanceKey = getQuery().getValues("businessKey");
  query = processDefinitionId == null ? query : query.processDefinitionId(processDefinitionId);
  query = processInstanceKey == null ? query : query.processInstanceBusinessKey(processInstanceKey);
  
  DataResponse response = new ProcessInstancesPaginateList().paginateList(getQuery(), query, "id", properties);
  return response;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:15,代码来源:ProcessInstancesResource.java

示例3: getInstanceById

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
/**
 * Get instances by instance Id and state
 *
 * @param instanceId
 * @param finished
 * @return list of BPMNInstances
 */
private BPMNInstance[] getInstanceById(String instanceId, boolean finished) {
    List<BPMNInstance> bpmnInstanceList = new ArrayList<>();
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    ProcessEngine engine = BPMNServerHolder.getInstance().getEngine();
    RuntimeService runtimeService = engine.getRuntimeService();
    ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().processInstanceTenantId(tenantId.toString());
    HistoricProcessInstanceQuery historicQuery = BPMNServerHolder.getInstance().getEngine().getHistoryService()
            .createHistoricProcessInstanceQuery().processInstanceTenantId(tenantId.toString()).includeProcessVariables();
    query = query.includeProcessVariables();
    if (finished) {
        historicQuery.finished();
    } else {
        historicQuery.unfinished();
    }
    historicQuery = historicQuery.processInstanceId(instanceId);
    HistoricProcessInstance instance = historicQuery.singleResult();
    if (instance != null) {
        processInstanceCount = 1;
        BPMNInstance bpmnInstance = new BPMNInstance();
        bpmnInstance.setInstanceId(instance.getId());
        bpmnInstance.setProcessId(instance.getProcessDefinitionId());
        List<ProcessDefinition> processes = BPMNServerHolder.getInstance().getEngine().getRepositoryService()
                .createProcessDefinitionQuery().processDefinitionTenantId(tenantId.toString())
                .processDefinitionId(instance.getProcessDefinitionId()).list();
        String processName = instance.getProcessDefinitionId();
        if (!processes.isEmpty()) {
            processName = processes.get(0).getName();
        }
        bpmnInstance.setProcessName(processName);
        if (!query.processInstanceId(instance.getId()).list().isEmpty()) {
            bpmnInstance.setSuspended(query.processInstanceId(instance.getId()).list().get(0).isSuspended());
        }
        bpmnInstance.setStartTime(instance.getStartTime());
        bpmnInstance.setEndTime(instance.getEndTime());
        bpmnInstance.setVariables(formatVariables(instance.getProcessVariables()));
        bpmnInstanceList.add(bpmnInstance);
    } else {
        processInstanceCount = 0;
    }
    return bpmnInstanceList.toArray(new BPMNInstance[bpmnInstanceList.size()]);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:49,代码来源:BPMNInstanceService.java

示例4: getQueryResponse

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
protected DataResponse getQueryResponse(HistoricProcessInstanceQueryRequest queryRequest, Map<String, String>
        allRequestParams) {

    HistoryService historyService = BPMNOSGIService.getHistoryService();
    HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();

    // Populate query based on request
    if (queryRequest.getProcessInstanceId() != null) {
        query.processInstanceId(queryRequest.getProcessInstanceId());
    }
    if (queryRequest.getProcessInstanceIds() != null && !queryRequest.getProcessInstanceIds().isEmpty()) {
        query.processInstanceIds(new HashSet<String>(queryRequest.getProcessInstanceIds()));
    }
    if (queryRequest.getProcessDefinitionKey() != null) {
        query.processDefinitionKey(queryRequest.getProcessDefinitionKey());
    }
    if (queryRequest.getProcessDefinitionId() != null) {
        query.processDefinitionId(queryRequest.getProcessDefinitionId());
    }
    if (queryRequest.getProcessBusinessKey() != null) {
        query.processInstanceBusinessKey(queryRequest.getProcessBusinessKey());
    }
    if (queryRequest.getInvolvedUser() != null) {
        query.involvedUser(queryRequest.getInvolvedUser());
    }
    if (queryRequest.getSuperProcessInstanceId() != null) {
        query.superProcessInstanceId(queryRequest.getSuperProcessInstanceId());
    }
    if (queryRequest.getExcludeSubprocesses() != null) {
        query.excludeSubprocesses(queryRequest.getExcludeSubprocesses());
    }
    if (queryRequest.getFinishedAfter() != null) {
        query.finishedAfter(queryRequest.getFinishedAfter());
    }
    if (queryRequest.getFinishedBefore() != null) {
        query.finishedBefore(queryRequest.getFinishedBefore());
    }
    if (queryRequest.getStartedAfter() != null) {
        query.startedAfter(queryRequest.getStartedAfter());
    }
    if (queryRequest.getStartedBefore() != null) {
        query.startedBefore(queryRequest.getStartedBefore());
    }
    if (queryRequest.getStartedBy() != null) {
        query.startedBy(queryRequest.getStartedBy());
    }
    if (queryRequest.getFinished() != null) {
        if (queryRequest.getFinished()) {
            query.finished();
        } else {
            query.unfinished();
        }
    }
    if (queryRequest.getIncludeProcessVariables() != null) {
        if (queryRequest.getIncludeProcessVariables()) {
            query.includeProcessVariables();
        }
    }
    if (queryRequest.getVariables() != null) {
        addVariables(query, queryRequest.getVariables());
    }

    if (queryRequest.getTenantId() != null) {
        query.processInstanceTenantId(queryRequest.getTenantId());
    }

    if (queryRequest.getTenantIdLike() != null) {
        query.processInstanceTenantIdLike(queryRequest.getTenantIdLike());
    }

    if (Boolean.TRUE.equals(queryRequest.getWithoutTenantId())) {
        query.processInstanceWithoutTenantId();
    }

    RestResponseFactory restResponseFactory = new RestResponseFactory();
    DataResponse dataResponse = new HistoricProcessInstancePaginateList(restResponseFactory, uriInfo).paginateList(
            allRequestParams, queryRequest, query, "processInstanceId", allowedSortProperties);

    return dataResponse;
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:81,代码来源:HistoricProcessInstanceService.java


注:本文中的org.activiti.engine.history.HistoricProcessInstanceQuery.unfinished方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。