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


Java HistoricProcessInstanceQuery.variableValueEquals方法代码示例

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


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

示例1: 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;
}
 
开发者ID:lz84,项目名称:bachelor,代码行数:31,代码来源:BpmHistoryServiceImpl.java

示例2: addVariables

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
protected void addVariables(HistoricProcessInstanceQuery processInstanceQuery, List<QueryVariable> variables) {
    for (QueryVariable variable : variables) {
        if (variable.getVariableOperation() == null) {
            throw new ActivitiIllegalArgumentException("Variable operation is missing for variable: " + variable.getName());
        }
        if (variable.getValue() == null) {
            throw new ActivitiIllegalArgumentException("Variable value is missing for variable: " + variable.getName());
        }

        boolean nameLess = variable.getName() == null;

        RestResponseFactory restResponseFactory = new RestResponseFactory();

        Object actualValue = restResponseFactory.getVariableValue(variable);

        // A value-only query is only possible using equals-operator
        if (nameLess && variable.getVariableOperation() != QueryVariable.QueryVariableOperation.EQUALS) {
            throw new ActivitiIllegalArgumentException("Value-only query (without a variable-name) is only supported when using 'equals' operation.");
        }

        switch (variable.getVariableOperation()) {

            case EQUALS:
                if (nameLess) {
                    processInstanceQuery.variableValueEquals(actualValue);
                } else {
                    processInstanceQuery.variableValueEquals(variable.getName(), actualValue);
                }
                break;

            case EQUALS_IGNORE_CASE:
                if (actualValue instanceof String) {
                    processInstanceQuery.variableValueEqualsIgnoreCase(variable.getName(), (String) actualValue);
                } else {
                    throw new ActivitiIllegalArgumentException("Only string variable values are supported when ignoring casing, but was: "
                            + actualValue.getClass().getName());
                }
                break;

            case NOT_EQUALS:
                processInstanceQuery.variableValueNotEquals(variable.getName(), actualValue);
                break;

            case LIKE:
                if (actualValue instanceof String) {
                    processInstanceQuery.variableValueLike(variable.getName(), (String) actualValue);
                } else {
                    throw new ActivitiIllegalArgumentException("Only string variable values are supported for like, but was: "
                            + actualValue.getClass().getName());
                }
                break;

            case GREATER_THAN:
                processInstanceQuery.variableValueGreaterThan(variable.getName(), actualValue);
                break;

            case GREATER_THAN_OR_EQUALS:
                processInstanceQuery.variableValueGreaterThanOrEqual(variable.getName(), actualValue);
                break;

            case LESS_THAN:
                processInstanceQuery.variableValueLessThan(variable.getName(), actualValue);
                break;

            case LESS_THAN_OR_EQUALS:
                processInstanceQuery.variableValueLessThanOrEqual(variable.getName(), actualValue);
                break;

            default:
                throw new ActivitiIllegalArgumentException("Unsupported variable query operation: " + variable.getVariableOperation());
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:74,代码来源:HistoricProcessInstanceService.java

示例3: 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;
		}
	}
 
开发者ID:lz84,项目名称:bachelor,代码行数:54,代码来源:BpmRepositoryServiceImpl.java


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