-
Task
-
Resolution: Done
-
Major
-
None
-
None
see also KOGITO-2754
1) improve transitionWorkItem
@POST() @Path("/{id}/firstLineApproval/{workItemId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public ApprovalsModelOutput completeTask_firstLineApproval_0(@PathParam("id") final String id, @PathParam("workItemId") final String workItemId, @QueryParam("phase") @DefaultValue("complete") final String phase, @QueryParam("user") final String user, @QueryParam("group") final List<String> groups, final Approvals_1_TaskOutput model) { try { return org.kie.kogito.services.uow.UnitOfWorkExecutor.executeInUnitOfWork(application.unitOfWorkManager(), () -> { ProcessInstance<ApprovalsModel> pi = process.instances().findById(id).orElse(null); .... org.kie.kogito.auth.IdentityProvider identity = ... org.jbpm.process.instance.impl.humantask.HumanTaskTransition transition = new org.jbpm.process.instance.impl.humantask.HumanTaskTransition(phase, model.toMap(), identity); pi.transitionWorkItem(workItemId, transition); .... }); } catch (WorkItemNotFoundException e) { return null; } }
e.g. implement a subclass or a factory for HumanTaskTransition that takes a phase a Model subclass (no explicit toMap())
or update the transitionWorkItem API
pi.transitionWorkItem(workItemId, model, policies(user, groups))
2) Improve workItem GET
@GET() @Path("/{id}/VisaApplication/{workItemId}") @Produces(MediaType.APPLICATION_JSON) public Travels_6_TaskInput getTask_VisaApplication_0(@PathParam("id") String id, @PathParam("workItemId") String workItemId, @QueryParam("user") final String user, @QueryParam("group") final List<String> groups) { .... WorkItem workItem = pi.workItem(workItemId, policies(user, groups)); if (workItem == null) { return null; } return Travels_6_TaskInput.fromMap(workItem.getId(), workItem.getName(), workItem.getParameters()); .... }
realize:
return pi.workItem(Travels_6_TaskInput.class, policies(user, groups));
- is incorporated by
-
KOGITO-2455 Rework Kogito code generation for scaffolding (processes)
- Resolved
- relates to
-
KOGITO-2754 Processes: Move policy handling out of REST endpoint
- Closed