@Override public Map<String, String> getRequiredInputData(String deploymentId, String processId) { return bpmn2Service.getProcessVariables(deploymentId, processId); }
@Override public Collection<ProcessVariableSummary> getVariablesCurrentState(long processInstanceId, String processId) { ProcessInstanceDesc piDesc = dataService.getProcessInstanceById(processInstanceId); Map<String, String> properties = new HashMap<String, String>(bpmn2Service.getProcessVariables(piDesc.getDeploymentId(), processId)); return VariableHelper.adaptCollection(dataService.getVariablesCurrentState(processInstanceId), properties, processInstanceId); }
public String getFormDisplayProcess(String containerId, String processId, String lang, boolean filterContent, String formType) { containerId = registry.getContainerId(containerId, ContainerLocatorProvider.get().getLocator()); ProcessDefinition processDesc = definitionService.getProcessDefinition(containerId, processId); if (processDesc == null) { throw new IllegalStateException("Process definition " + containerId + " : " + processId + " not found"); } Map<String, String> processData = definitionService.getProcessVariables(containerId, processId); if (processData == null) { processData = new HashMap<>(); } Map<String, Object> renderContext = new HashMap<>(); renderContext.put("process", processDesc); renderContext.put("outputs", processData); renderContext.put("lang", lang); renderContext.put("filterForm", filterContent); for (UIFormProvider provider : providers) { // if there's no formType or formType is ANY the first provider able to generate the formContent wins if (!FormType.ANY.getName().equals(formType) && !provider.getType().equals(formType)) { logger.debug("Provider {} does not support {} form type", provider, formType); continue; } String template = provider.render(processDesc.getName(), processDesc, renderContext); if (!StringUtils.isEmpty(template)) { return template; } } logger.warn("Unable to find form to render for process '{}'", processDesc.getName()); throw new IllegalStateException("No form for process with id " + processDesc.getName() + " found"); }
private List<ProcessVariableSummary> getProcessVariables(QueryFilter filter) { Long processInstanceId = null; String processId = ""; String deploymentId = ""; if (filter.getParams() != null) { processInstanceId = Long.valueOf((String) filter.getParams().get("processInstanceId")); processId = (String) filter.getParams().get("processDefId"); deploymentId = (String) filter.getParams().get("deploymentId"); } // append 1 to the count to check if there are further pages org.kie.internal.query.QueryFilter qf = new org.kie.internal.query.QueryFilter(filter.getOffset(), filter.getCount() + 1, filter.getOrderBy(), filter.isAscending()); Map<String, String> properties = new HashMap<String, String>(bpmn2Service.getProcessVariables(deploymentId, processId)); Collection<ProcessVariableSummary> processVariables = VariableHelper.adaptCollection(dataService.getVariablesCurrentState(processInstanceId), properties, processInstanceId); List<ProcessVariableSummary> processVariablesSums = new ArrayList<ProcessVariableSummary>(processVariables.size()); for (ProcessVariableSummary pv : processVariables) { if (filter.getParams().get("textSearch") == null || ((String) filter.getParams().get("textSearch")).isEmpty()) { processVariablesSums.add(pv); } else if (pv.getVariableId().toLowerCase().contains((String) filter.getParams().get("textSearch"))) { processVariablesSums.add(pv); } } return processVariablesSums; }
Map<String, String> properties = new HashMap<String, String>(bpmn2Service.getProcessVariables(deploymentId, processId)); Collection<ProcessVariableSummary> processVariables = VariableHelper.adaptCollection(dataService.getVariablesCurrentState(processInstanceId), properties, processInstanceId);
public VariablesDefinition getProcessVariables(String containerId, String processId) { containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator()); findProcessDefinition(containerId, processId); Map<String, String> processVariables = definitionService.getProcessVariables(containerId, processId); return new VariablesDefinition(processVariables); }