How to export a process?
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
Hello,
I found this method in Java
ByteArrayInputStream processInputStream = new ByteArrayInputStream(processAPI.exportBarProcessContentUnderHome(processInfo.getProcessId()));
but what about a REST CALL?