How to export a process?

1
0
-1

Hello,

for all artifact, we can IMPORT and EXPORT the artifact via the JAVA API.

For example, for a RestApi Extension, I can import it via

PageAPI.createPage(PageCreator pageCreator, byte[] content)

and export it via

byte[] PageAPI.<a href="https://documentation.bonitasoft.com/javadoc/api/7.6/org/bonitasoft/engine/api/PageAPI.html#getPageContent-long-">getPageContent</a>(long pageId)

For Organization, the same via

OrganizationAPI.ImportOrganization() and OrganizationAPI.Exportorganization()

So, all Artifact can be import / export, except that I don't see the method for a Business Process ?

businessArchive = BusinessArchiveFactory.readBusinessArchive(fileInput);

then

processAPI.deploy( businessArchive )

But do I get the BAR file from an existing process?

I see that method

protected void <a href="https://documentation.bonitasoft.com/javadoc/api/7.6/org/bonitasoft/engine/bpm/bar/BusinessArchiveFactory.html#writeBusinessArchiveToFile-org.bonitasoft.engine.bpm.bar.BusinessArchive-java.io.File-java.util.List-">writeBusinessArchiveToFile</a>(<a href="https://documentation.bonitasoft.com/javadoc/api/7.6/org/bonitasoft/engine/bpm/bar/BusinessArchive.html" title="class in org.bonitasoft.engine.bpm.bar">BusinessArchive</a> businessArchive, <a href="http://docs.oracle.com/javase/8/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> businessArchiveFile, <a href="http://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="https://documentation.bonitasoft.com/javadoc/api/7.6/org/bonitasoft/engine/bpm/bar/BusinessArchiveContribution.html" title="interface in org.bonitasoft.engine.bpm.bar">BusinessArchiveContribution</a>> contributions)

Note: there should be more useful to have not a File but a OutputStream.

So, it should be possible to get the BusinessArchive, but how?

Thanks you

Comments

Submitted by Pierre-yves Monnet on Fri, 09/04/2020 - 22:00

Hello,

I found this method in Java

ByteArrayInputStream processInputStream = new ByteArrayInputStream(processAPI.exportBarProcessContentUnderHome(processInfo.getProcessId()));

but what about a REST CALL?

1 answer

1
0
-1
This one is the BEST answer!

Hi,

The Java method you are mentioning is not available by default in REST.

You can still create a REST API extension to call the Java method if you need it.

HTH,

Captain Bonita

Notifications