本文整理汇总了Java中org.activiti.engine.history.HistoricProcessInstanceQuery.processDefinitionId方法的典型用法代码示例。如果您正苦于以下问题:Java HistoricProcessInstanceQuery.processDefinitionId方法的具体用法?Java HistoricProcessInstanceQuery.processDefinitionId怎么用?Java HistoricProcessInstanceQuery.processDefinitionId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.history.HistoricProcessInstanceQuery
的用法示例。
在下文中一共展示了HistoricProcessInstanceQuery.processDefinitionId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: getFinishedProcessInstance
import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
@Override
public List<HistoricProcessInstance> getFinishedProcessInstance(
String processDefinitionId, String taskKey, String startedOrgId,
Date startTime, Date endTime) {
List<HistoricProcessInstance> hpiList = new ArrayList<HistoricProcessInstance>();
HistoricProcessInstanceQuery hipQuery = historyService
.createHistoricProcessInstanceQuery().finished();
if (!StringUtils.isEmpty(processDefinitionId)) {
hipQuery.processDefinitionId(processDefinitionId);
}
if (startTime != null) {
hipQuery.startedAfter(startTime);
}
if (endTime != null) {
hipQuery.startedBefore(endTime);
}
if(!StringUtils.isEmpty(startedOrgId)){
hipQuery.variableValueEquals("startCompanyId", startedOrgId);
}
hpiList = hipQuery.includeProcessVariables().list();
/*for (HistoricProcessInstance hpi : hpiList) {
BaseBpDataEx bpDataEx = (BaseBpDataEx) historyService
.createHistoricVariableInstanceQuery()
.processInstanceId(hpi.getId())
.variableName(Constant.BPM_BP_DATA_EX_KEY).singleResult()
.getValue();
bpDataEx.getPiId();
}*/
return hpiList;
}
示例3: getUnfinishedProcessInstance
import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
@Override
public List<HistoricProcessInstance> getUnfinishedProcessInstance(
String processDefinitionId, String taskKey, String startedOrgId,
String startTime, String endTime) {
List<HistoricProcessInstance> hpiList = new ArrayList<HistoricProcessInstance>();
HistoricProcessInstanceQuery hipQuery = historyService
.createHistoricProcessInstanceQuery().finished()
.orderByProcessDefinitionId().desc();
if (processDefinitionId != null) {
hipQuery.processDefinitionId(processDefinitionId);
}
if (startTime != null) {
hipQuery.startedAfter(new Date(startTime));
}
if (endTime != null) {
hipQuery.startedBefore(new Date(endTime));
}
hpiList = hipQuery.includeProcessVariables().list();
for (HistoricProcessInstance hpi : hpiList) {
BaseBpDataEx bpDataEx = (BaseBpDataEx) historyService
.createHistoricVariableInstanceQuery()
.processInstanceId(hpi.getId())
.variableName(BpmConstant.BPM_BP_DATA_EX_KEY).singleResult()
.getValue();
bpDataEx.getPiId();
}
return null;
}
示例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;
}
示例5: queryProcess
import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
@Override
public List<HistoricProcessInstance> queryProcess(
String processDefinitionId, String taskDefinitionKey,
String startedOrgId, Date startTime, Date endTime) {
HistoricProcessInstanceQuery query = historyService
.createHistoricProcessInstanceQuery().unfinished();
if (processDefinitionId != null && !"".equals(processDefinitionId)) {
query.processDefinitionId(processDefinitionId);
}
if (startTime != null && !"".equals(startTime)) {
query.startedAfter(startTime);
}
if (endTime != null && !"".equals(endTime)) {
query.startedAfter(endTime);
}
if (!StringUtils.isEmpty(startedOrgId)) {
query.variableValueEquals("startCompanyId", startedOrgId);
}
List<HistoricProcessInstance> hPiList = query.list();
if (hPiList == null || hPiList.size() < 1)
return null;
List<HistoricProcessInstance> temphPis = new ArrayList<HistoricProcessInstance>();
for (HistoricProcessInstance pi : hPiList) {
// 获取流程的当前节点
// 执行实例
ExecutionEntity execution = (ExecutionEntity) runtimeService
.createProcessInstanceQuery().processInstanceId(pi.getId())
.singleResult();
String activityId = execution.getActivityId();
// 判断流程是否包含选定的节点定义key
if (taskDefinitionKey != null
&& StringUtils.isNotEmpty(taskDefinitionKey)
&& !taskDefinitionKey.equals(activityId)) {
// 将不满足条件的流程从集合中移除
temphPis.add(pi);
}
if (!StringUtils.isEmpty(startedOrgId)
&& !StringUtils.isEmpty(pi.getStartUserId())) {
String userId = pi.getStartUserId();
IBaseEntity user = authService.resolveUserByUserExp(userId);
// if (user != null && !startedOrgId.equals(user.getOrgId())) {
// temphPis.add(pi);
// }
}
}
// 将不满足条件的流程从集合中移除
hPiList.removeAll(temphPis);
if (hPiList.size() > 0) {
return hPiList;
} else {
return null;
}
}