[BONITA 6.2.6] Accessing process data once it has been closed

1
0
-1

Hi there,

There's something I don't understand with Bonita. How can we access data or documents once the process they were saved in got closed ?

Thanks for any hints ! Regards, Paul

3 answers

1
+1
-1
This one is the BEST answer!

The way Bonita handle archive is a little bit tricky.

First you need to know that a process instance will go through various states : initializing, executing, finishing...

In the main database table with "live" information, you will find only one row for this process instance, with a unique unmodified id. In this row you can find the process instance status. So the row get updated each time process instance status change.

Each time status change, the information located in table with "live" data will be moved (before update) to another table with "archived" information. Each time we have a change in status we have a new insertion in "archived" table. Each of this new row inserted will generated a new unique id.

So now, how do you connect your archived data to the original id from "live" data table? Answer is that you use " source object id "

Once a process is finished, row is deleted in "live" data table and you have multiple row in "archived" data table. Rows related to a single process instance all shared the same "source object id".

Comments

Submitted by paul33 on Wed, 10/29/2014 - 09:09

Thanks antoine.mottier and Sean McP I took a look at the database but i didn't make the connexion... Indeed it's a little bit tricky. I'll take some time to figure out how to handle it now.

1
0
-1

Hi there,

I have seen a function that is supposed to do exactly what I want : processAPI.getArchivedProcessDocument(sourceObjectId)

But I tried it whith the sourceObjectId and it doesn't work. So I tried it with id that I found in the arch_document_mapping table and it works...

I'm sorry but I don't understand ... we're asked to put the sourceObjectId in parameter but it works with the table id ? How can we get the id from the sourceObjectId ?

Thanks again for any help

1
0
-1

Hi Paul33,

Once a case is closed/completed all information/data of the process is stored in the archived tables.

Please use associated APIs to get the history of case : http://documentation.bonitasoft.com/get-history-case

And if you want to manipulate archived documents, associated API functions : http://documentation.bonitasoft.com/javadoc/api/6.3/org/bonitasoft/engin...

Hopefully it helps. Best regards, LL

Comments

Submitted by paul33 on Tue, 10/28/2014 - 17:48

Hi bos2013, Thanks for the help. I already tried it and in don't understand why I can't make it work. During the process, I save its processInstanceId. Afterward, when the process has been close, i tried :

final ProcessAPI processAPI = TenantAPIAccessor.getProcessAPI(apiSession); final ArchivedProcessInstance archivedProcessInstance = processAPI.getArchivedProcessInstance(processInstanceID);

where processInstanceId is the value I saved during the process. I get a :

org.bonitasoft.engine.bpm.process.ArchivedProcessInstanceNotFoundException: org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceNotFoundException: Process instance with id <14009> not found

I really don't understand why it doesn't work ... Has the processInstanceId changed when it was archived ?

Thanks again, Regards, Paul

Submitted by Sean McP on Wed, 10/29/2014 - 04:32

HI Paul,

good question and I'll be using this as reference later,

I think though in this instance "source object id" is different from processInstanceID, but what it is is another matter. I don't know. The examples sometimes use "cross-use" words I've found (and processInstanceID is a favorite).

What I've done in the past is have a look at the actual database to figure out the real column name, there are several good H2 database viewers out there.

regards Seán

Notifications