Skip to content

Commit

Permalink
Fix case manual process start for C8 (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
francav authored May 31, 2024
2 parents 0d02dc9 + 608f48c commit 2e13970
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
*/
package com.wks.bpm.engine.camunda.client;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
Expand Down Expand Up @@ -115,7 +117,11 @@ public Task[] findTasks(final Optional<String> processInstanceBusinessKey, final
ProcessInstance[] processInstances = operateClient.searchProcessInstances(Optional.empty(),
processInstanceBusinessKey, Optional.empty(), bpmEngine);

return processInstances.length > 0 ? tasklistClient.find(processInstances[0].getId(), bpmEngine) : new Task[0];
List<Task> allTasks = Arrays.stream(processInstances)
.flatMap(processInstance -> Arrays.stream(tasklistClient.find(processInstance.getId(), bpmEngine)))
.collect(Collectors.toList());

return allTasks.toArray(new Task[0]);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ public ProcessDefinition[] findProcessDefinitions(BpmEngine bpmEngine) {

.map(o ->

ProcessDefinitionImpl.builder().bpmEngineId(bpmEngine.getId()).id(o.getBpmnProcessId())
.key(String.valueOf(o.getKey())).version(String.valueOf(o.getVersion())).name(o.getName())
// for C8, case definition BpmnProcessId = WKS process definition key
// for C8, case definition key = WKS process definition Id
ProcessDefinitionImpl.builder().bpmEngineId(bpmEngine.getId()).id(String.valueOf(o.getKey()))
.key(o.getBpmnProcessId()).version(String.valueOf(o.getVersion())).name(o.getName())
.build())

.toArray(ProcessDefinitionImpl[]::new);
Expand Down

0 comments on commit 2e13970

Please sign in to comment.