Hello everybody,
I deal with a task to automatize export of some hundreds BPMN 2.0 Collaboration diagrams. I have tried with context option on a model in Aris ( Export -> Export BPMN diagram as a BPMN file...).
This output is exactly what will be necessary, but such export is fine only for a few models. When I select more models and try to export it according this method one *.BPMN file (as a merge of all selected models) is created.
I need output each model as a single *.BPMN file (for all selected models). If you know similar functionality, which could be done by one of Aris script reports, it will be good. (source code of "Export BPMN diagram as a BPMN file..." which I could modify will be pefect as well.. )
I tried output .xml files, but the structure within <AML> system is not sufficient.
I appreciate every answer/advice,
Thanks.
Libor
Tested on ARIS Cloud Enterprise (10.0.11.0.1400208)
var oModelInterchange = Context.getComponent("ModelInterchange");
var aSelectedModels = ArisData.getSelectedModels()
for(var nSelectedModel=0;nSelectedModel<aSelectedModels.length;nSelectedModel++){
var aModelValidationResults = oModelInterchange.validateBpmnDiagramForExport(aSelectedModels[nSelectedModel])
if(aModelValidationResults.length==0){
var oExportOptions = oModelInterchange.createExportOptions()
oExportOptions.setLocale(Context.getSelectedLanguage());
oExportOptions.setModelsToExport(aSelectedModels[nSelectedModel])
var oModelExportResult = oModelInterchange.startBpmnExport(oExportOptions)
if(oModelExportResult.isSuccessful()){
Context.addOutputFile(aSelectedModels[nSelectedModel].Attribute(Constants.AT_NAME,Context.getSelectedLanguage()).GetValue(true)+".bpmn", oModelExportResult.getFileResult())
}
}
}
Thank you Milan for your answer!
I have checked Aris help for such functions you are presenting (in component "ModelInterchange"), great to have some explanations as well. I use a specially transformed EPCs (customized) -> to BPMNs, so I skipped validation part of BPMNs (which supplies BPMN semantic/notation checks, I will test validateBpmnDiagramForExport on selected models later).
My current code:
for (var iSI = 0; iSI < g_aoSelItems.length; iSI++) {
var oExportOptions = getExportOptions(xmlExportComp, g_aoSelItems[iSI], _nLoc); //for each model
var sOutFileName = getValidFilename(g_aoSelItems[iSI].Name(-1) + ".bpmn"); // clean file name from not allowed chars
var oExportResult = xmlExportComp.startBpmnExport(oExportOptions);
if (oExportResult.isSuccessful()) {
Context.addOutputFile(sOutFileName, oExportResult.getFileResult());
}
}
When I compare the output of the report and standard context export result it looks similar, but in the report output, there are more attributes (tags) like "AT_CREATOR", "AT_CREAT_TIME_STMP", "AT_LAST_CHNG_2", "AT_LUSER". Nevertheles, it is ok.
(tested on Aris Architect 10.0.10.1.1447832)