Search in sources :

Example 1 with Exporter

use of com.centurylink.mdw.plugin.designer.Exporter in project mdw-designer by CenturyLinkCloud.

the class ExportAttributesWizard method performImportExport.

void performImportExport(ProgressMonitor progressMonitor) throws IOException, XmlException, DataAccessException, ActionCancelledException {
    Exporter exporter = new Exporter(getProject().getDesignerDataAccess());
    progressMonitor.start("Exporting Attributes...");
    progressMonitor.progress(15);
    String xmlString;
    if (getProcess() != null)
        xmlString = exporter.exportAttributes(getPrefix(), getProcess(), progressMonitor);
    else
        xmlString = exporter.exportAttributes(getPrefix(), getPackage(), progressMonitor);
    progressMonitor.progress(10);
    progressMonitor.subTask("Writing XML file");
    writeFile(getPage().getFilePath(), xmlString.getBytes());
    progressMonitor.progress(5);
}
Also used : Exporter(com.centurylink.mdw.plugin.designer.Exporter)

Example 2 with Exporter

use of com.centurylink.mdw.plugin.designer.Exporter in project mdw-designer by CenturyLinkCloud.

the class ExportPackageWizard method performImportExport.

void performImportExport(ProgressMonitor progressMonitor) throws IOException, JSONException, XmlException, DataAccessException, ActionCancelledException {
    Exporter exporter = new Exporter(getProject().getDesignerDataAccess());
    boolean exportJson = false;
    boolean includeTaskTemplates = false;
    boolean inferReferencedImpls = false;
    boolean exportZip = false;
    IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore();
    if (getProject().isFilePersist()) {
        exportJson = prefsStore.getBoolean(PreferenceConstants.PREFS_EXPORT_JSON_FORMAT);
        includeTaskTemplates = !prefsStore.getBoolean(PreferenceConstants.PREFS_SUPPRESS_TASK_TEMPLATES_IN_PKG_EXPORT);
        exportZip = prefsStore.getBoolean(PreferenceConstants.PREFS_EXPORT_ZIP_FORMAT);
    } else {
        inferReferencedImpls = !prefsStore.getBoolean(PreferenceConstants.PREFS_SUPPRESS_INFER_REFERENCED_IMPLS_DURING_EXPORT);
    }
    List<WorkflowPackage> packages = getPackages();
    String export = null;
    if (exportZip) {
        File assetDir = getProject().getAssetDir();
        List<File> includes = new ArrayList<>();
        for (WorkflowPackage pkg : packages) includes.add(new File(assetDir + "/" + pkg.getName().replace('.', '/')));
        ZipHelper.zipWith(assetDir, new File(getPage().getFilePath()), includes);
    } else if (packages.size() == 1 && !exportJson)
        export = exporter.exportPackage(packages.get(0), includeTaskTemplates, inferReferencedImpls, progressMonitor);
    else
        export = exporter.exportPackages(packages, exportJson, includeTaskTemplates, progressMonitor);
    progressMonitor.progress(10);
    progressMonitor.subTask("Writing " + (exportJson ? "JSON" : "XML") + " file");
    if (export != null)
        writeFile(getPage().getFilePath(), export.getBytes());
    progressMonitor.progress(5);
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ArrayList(java.util.ArrayList) Exporter(com.centurylink.mdw.plugin.designer.Exporter) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) File(java.io.File)

Example 3 with Exporter

use of com.centurylink.mdw.plugin.designer.Exporter in project mdw-designer by CenturyLinkCloud.

the class ExportProcessWizard method performImportExport.

void performImportExport(ProgressMonitor progressMonitor) throws IOException, XmlException, DataAccessException {
    Exporter exporter = new Exporter(getProject().getDesignerDataAccess());
    String xmlString = exporter.exportProcess(getProcess().getName(), getProcess().getVersionString(), false);
    progressMonitor.progress(10);
    progressMonitor.subTask("Writing XML file");
    String fileName = getPage().getFilePath();
    writeFile(fileName, xmlString.getBytes());
    progressMonitor.progress(5);
}
Also used : Exporter(com.centurylink.mdw.plugin.designer.Exporter)

Example 4 with Exporter

use of com.centurylink.mdw.plugin.designer.Exporter in project mdw-designer by CenturyLinkCloud.

the class ExportTaskTemplatesWizard method performImportExport.

void performImportExport(ProgressMonitor progressMonitor) throws IOException, XmlException, DataAccessException, ActionCancelledException {
    Exporter exporter = new Exporter(getProject().getDesignerDataAccess());
    progressMonitor.start("Exporting Task Templates...");
    progressMonitor.progress(15);
    String xmlString = exporter.exportTaskTemplates(getPackage(), progressMonitor);
    progressMonitor.progress(10);
    progressMonitor.subTask("Writing XML file");
    writeFile(getPage().getFilePath(), xmlString.getBytes());
    progressMonitor.progress(5);
}
Also used : Exporter(com.centurylink.mdw.plugin.designer.Exporter)

Aggregations

Exporter (com.centurylink.mdw.plugin.designer.Exporter)4 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1