Search in sources :

Example 1 with EEcosCategory

use of org.talend.dataprofiler.core.helper.EEcosCategory in project tdq-studio-se by Talend.

the class ImportRemotePatternAction method doImportAfterDownload.

private void doImportAfterDownload(IJobChangeEvent event) {
    final List<ReturnCode> information = new ArrayList<ReturnCode>();
    setEnabled(true);
    if (fExtensionDownloaded > 0) {
        // $NON-NLS-1$
        String csvFormat = System.getProperty("talend.exchange.csv");
        if ("true".equals(csvFormat)) {
            // $NON-NLS-1$
            for (IEcosComponent componet : fInstalledComponents) {
                List<ImportObject> validImportObject = ImportObject.extractImportObject(componet, information);
                if (!validImportObject.isEmpty()) {
                    String categoryName = componet.getCategry().getName();
                    EEcosCategory ecosCategory = EEcosCategory.getEcosCategory(categoryName);
                    if (ecosCategory != null) {
                        EResourceConstant resourceType = ecosCategory.getResource();
                        for (ImportObject importObject : validImportObject) {
                            information.addAll(ImportFactory.doImport(resourceType, importObject, componet.getName()));
                        }
                    }
                }
            }
            // MOD qiongli 2011-11-28 TDQ-4038,give the message when there is nothing to import.
            if (information.isEmpty()) {
                information.add(new ReturnCode(DefaultMessagesImpl.getString("ImportRemotePatternAction.NothingImport"), // $NON-NLS-1$
                false));
            }
            ImportInfoDialog.openImportInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("ImportRemotePatternAction.ImportFinish"), // $NON-NLS-1$
            information.toArray(new ReturnCode[0]));
            CorePlugin.getDefault().refreshDQView();
        } else {
            Display.getDefault().asyncExec(new Runnable() {

                public void run() {
                    for (IEcosComponent componet : fInstalledComponents) {
                        try {
                            ImportFactory.importFromExchange(componet);
                        } catch (Exception e) {
                            ExceptionHandler.process(e);
                        }
                    }
                }
            });
        }
    }
}
Also used : EResourceConstant(org.talend.resource.EResourceConstant) ReturnCode(org.talend.utils.sugars.ReturnCode) EEcosCategory(org.talend.dataprofiler.core.helper.EEcosCategory) ArrayList(java.util.ArrayList) IEcosComponent(org.talend.dataprofiler.ecos.model.IEcosComponent) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 EEcosCategory (org.talend.dataprofiler.core.helper.EEcosCategory)1 IEcosComponent (org.talend.dataprofiler.ecos.model.IEcosComponent)1 EResourceConstant (org.talend.resource.EResourceConstant)1 ReturnCode (org.talend.utils.sugars.ReturnCode)1