Get Task Output/Input variables from started Human Task

瀏覽次數:908 次
跳到第一則未讀訊息

Robert Skibiński

未讀,
2017年4月19日 清晨7:26:062017/4/19
收件者:jBPM Usage
Hi all,
I'm having troubles with getting populated map from task instance 

RestDeployer client = new RestDeployer(deploymentId, new URL(appUrl), user, password);
        RuntimeEngine engine = client.getEngine();


        KieSession kSession = engine.getKieSession();
        TaskService taskService = engine.getTaskService();


        ProcessInstance processInstance = client.startProcess(kSession);
        List<Status> statuses = new ArrayList<>();
        statuses.add(Status.Ready);

        List<TaskSummary> taskSummaries = taskService.getTasksByStatusByProcessInstanceId(processInstance.getId(), statuses, user);
        int i = 0;
        for (TaskSummary taskSummary : taskSummaries) {
            taskService.claim(taskSummary.getId(), user);
            taskService.start(taskSummary.getId(), user);
            Map<String, Object> map = new HashMap<>();
            map.put("t1_var1", "Test" + i++); // I want to extract "t1_var1" from TaskData related to Task from this TaskSummary
            map.put("t1_var2", i);
            taskService.complete(taskSummary.getId(), user, map);
        }

calling 
taskService.getTaskById(taskId).getTaskData().getTaskInputVariables()
results in empty map. Is it a flaw in REST API or do I understand the usage of this method wrong? I would like to extract mapping of I/O variables defined in Workbench.

Robert Skibiński

未讀,
2017年4月19日 清晨7:27:492017/4/19
收件者:jBPM Usage
I was also wondering if there exists a Java API for operating on form related to the Human Task, or the only option is to use JavaScript REST API to inject iframe with form into my page?

Maciej Swiderski

未讀,
2017年4月19日 清晨7:37:362017/4/19
收件者:Robert Skibiński、jBPM Usage
I would recommend to switch to KIE Server as execution server accessible via REST - see this article as starting point (Unified KIE Execution Server - Part 1) plus following articles in the series.

When it comes to working with forms this can help jBPM UI extension on KIE Server

Maciej
--
You received this message because you are subscribed to the Google Groups "jBPM Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-usage+...@googlegroups.com.
To post to this group, send email to jbpm-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbpm-usage/f38e9eb3-043b-4c34-b9c8-f0e94fbc097f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert Skibiński

未讀,
2017年4月20日 上午9:56:102017/4/20
收件者:jBPM Usage、enedh...@gmail.com
Thanks for response - I followed your tips and switched to architecture of KIE Server and KIE Workbench deployed on one WildFly 10 standalone instance. 
I have few more questions:
  1. When I start process via KIE Workbench/REST Deployer(as in first post) it starts within KIE Workbench internal KIE engine. Is it possible to force it to start inside deployed container in KIE Server?
  2. When I start process on KIE Server using client as in http://mswiderski.blogspot.com/2015/09/unified-kie-execution-server-part-2.html I have access to all its' parts (and what interests me most: forms connected) but I can't see nor access it from KIE Workbench. Both KIE Workbench and KIE Server are configured to use the same datasource and process and exists in database. Is it possible to view tasks/processes running on instances of registered KIE Servers in KIE Workbench?
    ./standalone.sh --server-config=standalone-full.xml -Dorg.kie.server.id=kie-server -Dorg.kie.server.location=http://localhost:8080/kie-server/services/rest/server -b 0.0.0.0 -Dorg.kie.server.controller=http://localhost:8080/kie-wb/rest/controller -Dorg.kie.server.persistence.ds=java:jboss/datasources/PostgresqlDS -Dorg.kie.server.persistence.dialect=org.hibernate.dialect.PostgreSQLDialect

Maciej Swiderski

未讀,
2017年4月20日 上午10:58:382017/4/20
收件者:Robert Skibiński、jBPM Usage
Robert,
On 20 Apr 2017, at 15:56, Robert Skibiński <enedh...@gmail.com> wrote:

Thanks for response - I followed your tips and switched to architecture of KIE Server and KIE Workbench deployed on one WildFly 10 standalone instance. 
I have few more questions:
  1. When I start process via KIE Workbench/REST Deployer(as in first post) it starts within KIE Workbench internal KIE engine. Is it possible to force it to start inside deployed container in KIE Server?
not in version 6, version 7 will include only kie server as runtime envrionemtn so there won’t be any REST api for jBPM in workbench any more. That’s said I’d recommend to not rely on that REST api any more.
in version 7 workbench UI with transparently use KIE Server, see this article for details: jBPM v7 - workbench and kie server integration

  1. When I start process on KIE Server using client as in http://mswiderski.blogspot.com/2015/09/unified-kie-execution-server-part-2.html I have access to all its' parts (and what interests me most: forms connected) but I can't see nor access it from KIE Workbench. Both KIE Workbench and KIE Server are configured to use the same datasource and process and exists in database. Is it possible to view tasks/processes running on instances of registered KIE Servers in KIE Workbench?
    ./standalone.sh --server-config=standalone-full.xml -Dorg.kie.server.id=kie-server -Dorg.kie.server.location=http://localhost:8080/kie-server/services/rest/server -b 0.0.0.0 -Dorg.kie.server.controller=http://localhost:8080/kie-wb/rest/controller -Dorg.kie.server.persistence.ds=java:jboss/datasources/PostgresqlDS -Dorg.kie.server.persistence.dialect=org.hibernate.dialect.PostgreSQLDialect

it can be done in 6.5 only and the main trick is that you name the container in kie server exactly the same as deployment id in workbench (e.g. org.jbpm:HR:1.0) should be deployment id in workbench and container id in kie server. Here you can find bit of help in the comments of the above article 

Maciej
回覆所有人
回覆作者
轉寄
0 則新訊息