public String getProcessInstanceVariables(String containerId, Number processInstanceId, String marshallingType) { containerId = context.getContainerId(containerId, new ByProcessInstanceIdContainerLocator(processInstanceId.longValue())); Map<String, Object> variables = processService.getProcessInstanceVariables(containerId, processInstanceId.longValue()); logger.debug("About to marshal process variables {}", variables); String response = marshallerHelper.marshal(containerId, marshallingType, variables); return response; }
public String getProcessInstance(String containerId, Number processInstanceId, boolean withVars, String marshallingType) { ProcessInstanceDesc instanceDesc = runtimeDataService.getProcessInstanceById(processInstanceId.longValue()); if (instanceDesc == null) { throw new IllegalStateException("Unable to find process instance with id " + processInstanceId); } containerId = context.getContainerId(containerId, new ByProcessInstanceIdContainerLocator(processInstanceId.longValue())); org.kie.server.api.model.instance.ProcessInstance processInstance = convertToProcessInstance(instanceDesc); if (Boolean.TRUE.equals(withVars) && processInstance.getState().equals(ProcessInstance.STATE_ACTIVE)) { Map<String, Object> variables = processService.getProcessInstanceVariables(containerId, processInstanceId.longValue()); processInstance.setVariables(variables); } logger.debug("About to marshal process instance with id '{}' {}", processInstanceId, processInstance); String response = marshallerHelper.marshal(containerId, marshallingType, processInstance, new ByProcessInstanceIdContainerLocator(processInstanceId.longValue())); return response; }