Mike
Mike

Reputation: 832

How to access Procress Variables using the Remoting API

I have a process running on the workbench that comes with the JBPM Demo. I can successfully start a process with a Map of Process Variables. In the following user task, I need to retrieve the process variables to display on the GUI. I can successfully retrieve the Process Instance. On the non-remoting API I would cast the process instance into its actual class of RuleFlowProcessInstance and call the getVariable method. When I use the Remoting API, the Process Instance is of type JaxbProcessInstanceResponse and does not have a getVariable method. Is there some other way to look up process variables while using the Remoting API? Below is my code to obtain the process instance.

url = new URL("http://127.0.0.1:8080/jbpm-console");
restFactory = new RemoteRestRuntimeEngineFactory(
    DEPLOYMENT_ID, url, JMS_USER, JMS_PASS);
engine = restFactory.newRuntimeEngine();
session = engine.getKieSession();
List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner(
    user, LANGUAGE);
for(TaskSummary summary : list) {
    ProcessInstance pi = session.getProcessInstance(
        summary.getProcessInstanceId());
    JaxbProcessInstanceResponse resp = (JaxbProcessInstanceResponse)pi;
    //TODO: somehow lookup Process Variables
}

Upvotes: 1

Views: 564

Answers (1)

antmendoza
antmendoza

Reputation: 401

You have to use AuditLogService interface.

AuditService audit = engine.getAuditLogService();

I think for your purpose using the findVariableInstances(long processInstanceId, String variableId) method will be fine.

Check available AuditLogService methods from documentation (http://docs.jboss.org/jbpm/v6.1/userguide/jBPMRemoteAPI.html#remote.java.api.jms), table 17.12

Upvotes: 1

Related Questions