use of com.centurylink.mdw.dataaccess.ProcessExporter in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method exportPackage.
public String exportPackage(Long packageId, int schemaVersion, boolean includeTaskTemplates, ProgressMonitor monitor) throws DataAccessException, ActionCancelledException, XmlException {
if (monitor != null)
monitor.subTask("Loading package...");
PackageVO packageVO = loadPackage(packageId, true);
if (monitor != null)
monitor.progress(30);
if (monitor != null) {
if (monitor.isCanceled())
throw new ActionCancelledException();
else
monitor.subTask("Sorting processes and implementors");
}
// adding same logic as in PopupHandler export to get same result
for (ProcessVO processVO : packageVO.getProcesses()) new ProcessWorker().convert_to_designer(processVO);
if (packageVO.getRuleSets() != null) {
Map<String, CustomAttributeVO> customAttrs = new HashMap<>();
for (RuleSetVO ruleSet : packageVO.getRuleSets()) {
if (ruleSet.getLanguage() != null && !customAttrs.containsKey(ruleSet.getLanguage())) {
CustomAttributeVO custAttrVO = getCustomAttribute("RULE_SET", ruleSet.getLanguage());
if (custAttrVO != null)
customAttrs.put(ruleSet.getLanguage(), custAttrVO);
}
}
List<CustomAttributeVO> customAttributes = new ArrayList<>();
for (CustomAttributeVO customAttr : customAttrs.values()) customAttributes.add(customAttr);
packageVO.setCustomAttributes(customAttributes);
}
if (monitor != null && monitor.isCanceled())
throw new ActionCancelledException();
if (monitor != null)
monitor.progress(5);
if (monitor != null)
monitor.subTask(EXPORTXML);
ProcessExporter exporter = DataAccess.getProcessExporter(schemaVersion, oldNamespaces ? DesignerCompatibility.getInstance() : null);
String xml = exporter.exportPackage(packageVO, includeTaskTemplates);
if (monitor != null)
monitor.progress(25);
packageVO.setExported(true);
persister.persistPackage(packageVO, PersistType.UPDATE);
if (monitor != null)
monitor.progress(15);
return xml;
}
Aggregations