i have tree questions about the open-source flowable.
it is important about
What all cases have in common is that there should be no server restart due to xml changes.
is it possible?
Can flowable change the person in charge to someone else? here is my process. i want to it Ken to Roy in my process. enter image description here
Can flowable add a task without changing the xml of BPMN? I want to add service task in process without server restart. enter image description here
If rejected during the process, will all of the history be accumulated? If Ben reject and then process is reset, but The history records is accumulated. Tom approved, Ken approved, Ben Reject then this process start first tom. enter image description here
I really appreciate your help. Thank you!!!
I ran the demo and checked the task logic, and I saw the table structure.
But it's still not enough to understand the above.
here is my source code WorkflowService in spring boot application
demo
controller
@Slf4j
@RestController
public class ArticleWorkflowController {
@Autowired
private ArticleWorkflowService service;
@PostMapping("/submit")
public void submit(@RequestBody Article article) {
service.startProcess(article);
}
@PostMapping("/restart")
public void restart(@RequestBody Article article) {
service.restartProcess(article);
}
@GetMapping("/tasks")
public List<Article> getTasks(@RequestParam String assignee) {
return service.getTasks(assignee);
}
@PostMapping("/review")
public void review(@RequestBody Approval approval) {
service.submitReview(approval);
}
@GetMapping("/history")
public List<HistoricActivityInstance> getHistoryList() {
return service.getHistory();
}
}
Service
@Slf4j
@RequiredArgsConstructor
@Service
public class ArticleWorkflowService {
private final RuntimeService runtimeService;
private final ProcessEngine processEngine;
private final TaskService taskService;
@Transactional
public void startProcess(Article article) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("author", article.getAuthor());
variables.put("url", article.getUrl());
runtimeService.startProcessInstanceByKey("articleReview", variables);
log.info("task size is {}", taskService.createTaskQuery().list().size());
}
@Transactional
public void restartProcess(Article article) {
Map<String, Object> variables = new HashMap<>();
variables.put("author", article.getAuthor());
variables.put("url", article.getUrl());
//
//
//
// runtimeService.startProcessInstanceByKey("articleReview", variables);
}
@Transactional
public List<Article> getTasks(String assignee) {
List<Task> tasks = taskService.createTaskQuery()
.taskCandidateGroup(assignee)
.list();
return tasks.stream()
.map(task -> {
Map<String, Object> variables = taskService.getVariables(task.getId());
return new Article(
task.getId(), (String) variables.get("author"), (String) variables.get("url"));
})
.collect(Collectors.toList());
}
@Transactional
public void submitReview(Approval approval) {
Map<String, Object> variables = new HashMap<>();
variables.put("approved", approval.isStatus());
taskService.complete(approval.getId(), variables);
}
@Transactional(readOnly = true)
public List<HistoricActivityInstance> getHistory() {
HistoryService historyService = processEngine.getHistoryService();
return historyService.createHistoricActivityInstanceQuery()
.list();
}
}