Create and persist user task

1
0
-1

Hello Bonita friends,

we're working on Bonita BPM adapter that should be able to communicate between two BPM worlds (Bonita BPM 6.3 and our BPM Inbox which is a BPM framework with its own API). Actually we have done Acitivi and Adobe LC adapters that both communicate with our BPM Inbox very well. Now we're adding the third adapter - Bonita BPM.

We have a business requirement to create a UserTask and save it in Bonita world using Bonita BPM API 6.3. We have to create it from non-Bonita object UserTask (without ID). Once it's created and saved in Bonita BPM, it's converted to non-Bonita object UserTask and returned back with newly created ID.

To do this, we need to take all the parameters from this non-Bonita object and somehow pass them to the Bonita BPM infrastructure (some Bonita builders or whatever), call some Bonita API feature(s) that would return HumanTaskInstance or at least its ID.

Here're some details on non-Bonita object that we need to pass to the Bonita BPM world and create HumanTaskInstance from it: createTime (when the task was created), delegationState, description, dueDate (when the task should be finished), id (available only for persisted object), name (name of the task), priority (number value), suspend (true or false), subtasks (set of subtasks, it can be undefined), parent (parent UserTask object), starter (user who created the adhoc task, in other cases can be undefined), assignee (user who compile the task), owner (user to whom the task is delegated), userCandidates (list of potential candidates of the task), groupCandidates (list of groups of potential candidates of the task), comment (an object that holds user's comments), attachments

Is something like this even possible?

We looked into the Bonita source code and found this: org.bonitasoft.engine.service.TenantServiceAccessor.getBPMInstancesCreator() that returns org.bonitasoft.engine.bpm.model.impl.BPMInstancesCreator. Once we would have this, we could call:

public SFlowNodeInstance toFlowNodeInstance(final long processDefinitionId, final long rootContainerId, final long parentContainerId, final SFlowElementsContainerType parentContainerType, final SFlowNodeDefinition sFlowNodeDefinition, final long rootProcessInstanceId, final long parentProcessInstanceId, final boolean createInnerActivity, final int loopCounter, final SStateCategory stateCategory, final long relatedActivityInstanceId, final Long tokenRefId) throws SActorNotFoundException, SActivityReadException { }

But this approach looks like not usable because mentioned calls are internal usable in Bonita engine only, so we cannot implement it this way.

Another reason could be (similar to Oracle BPEL) that there's no ad hoc task (only task based on process) meaning that user task can only be created by a process and therefore there's no external API for creating such task (HumanTaskInstance).

Can someone help on this?

Thanks in advance, Majo

1 answer

1
0
-1

From what I can see, yes everything you want to do is possible. In-fact I've pretty much done much of what you want to do within my own project, obviously only to a point.

You could use a REST call with all the data to fire off an intermediary process, which does the work and returns the ID, or if you are able to interface directly just use a java program.

There is much though that needs proper definition - sub-tasks for example - a full write up of the whole piece would be necessary.

I would start small like get it to fire and return an ID first, then add bits as necessary - the agile approach if you wish.

I suspect you want a template Process that can act as a switcher to all other processes and from there start a process and get the id of the human task. This is all possible in community without rewriting the Bonita product.

regards Seán

Notifications