Search in sources :

Example 1 with IDataTransferSettings

use of org.jkiss.dbeaver.tools.transfer.IDataTransferSettings in project dbeaver by serge-rider.

the class DataTransferJob method transferData.

private boolean transferData(DBRProgressMonitor monitor, DataTransferPipe transferPipe) {
    IDataTransferProducer producer = transferPipe.getProducer();
    IDataTransferConsumer consumer = transferPipe.getConsumer();
    IDataTransferSettings consumerSettings = settings.getNodeSettings(consumer);
    setName(NLS.bind(CoreMessages.data_transfer_wizard_job_container_name, CommonUtils.truncateString(producer.getSourceObject().getName(), 200)));
    IDataTransferSettings nodeSettings = settings.getNodeSettings(producer);
    try {
        //consumer.initTransfer(producer.getSourceObject(), consumerSettings, );
        producer.transferData(monitor, consumer, nodeSettings);
        consumer.finishTransfer(monitor, false);
        return true;
    } catch (Exception e) {
        new DataTransferErrorJob(e).schedule();
        return false;
    }
}
Also used : IDataTransferSettings(org.jkiss.dbeaver.tools.transfer.IDataTransferSettings) IDataTransferConsumer(org.jkiss.dbeaver.tools.transfer.IDataTransferConsumer) IDataTransferProducer(org.jkiss.dbeaver.tools.transfer.IDataTransferProducer)

Example 2 with IDataTransferSettings

use of org.jkiss.dbeaver.tools.transfer.IDataTransferSettings in project dbeaver by serge-rider.

the class DataTransferPageFinal method activatePage.

@Override
public void activatePage() {
    resultTable.removeAll();
    DataTransferSettings settings = getWizard().getSettings();
    List<DataTransferPipe> dataPipes = settings.getDataPipes();
    for (DataTransferPipe pipe : dataPipes) {
        IDataTransferSettings consumerSettings = settings.getNodeSettings(pipe.getConsumer());
        IDataTransferProcessor processor = null;
        if (settings.getProcessor() != null) {
            // Processor is optional
            try {
                processor = settings.getProcessor().getInstance();
            } catch (Throwable e) {
                log.error("Can't create processor", e);
                continue;
            }
        }
        pipe.getConsumer().initTransfer(pipe.getProducer().getSourceObject(), consumerSettings, processor, processor == null ? null : settings.getProcessorProperties());
        TableItem item = new TableItem(resultTable, SWT.NONE);
        item.setText(0, DBUtils.getObjectFullName(pipe.getProducer().getSourceObject(), DBPEvaluationContext.UI));
        if (settings.getProducer() != null && settings.getProducer().getIcon() != null) {
            item.setImage(0, DBeaverIcons.getImage(settings.getProducer().getIcon()));
        }
        item.setText(1, pipe.getConsumer().getTargetName());
        if (settings.getProcessor() != null && settings.getProcessor().getIcon() != null) {
            item.setImage(1, DBeaverIcons.getImage(settings.getProcessor().getIcon()));
        } else if (settings.getConsumer() != null && settings.getConsumer().getIcon() != null) {
            item.setImage(1, DBeaverIcons.getImage(settings.getConsumer().getIcon()));
        }
    }
    activated = true;
    UIUtils.packColumns(resultTable, true);
    updatePageCompletion();
}
Also used : IDataTransferSettings(org.jkiss.dbeaver.tools.transfer.IDataTransferSettings) IDataTransferProcessor(org.jkiss.dbeaver.tools.transfer.IDataTransferProcessor) IDataTransferSettings(org.jkiss.dbeaver.tools.transfer.IDataTransferSettings) TableItem(org.eclipse.swt.widgets.TableItem)

Example 3 with IDataTransferSettings

use of org.jkiss.dbeaver.tools.transfer.IDataTransferSettings in project dbeaver by dbeaver.

the class DataTransferJob method transferData.

private boolean transferData(DBRProgressMonitor monitor, DataTransferPipe transferPipe) {
    IDataTransferProducer producer = transferPipe.getProducer();
    IDataTransferConsumer consumer = transferPipe.getConsumer();
    IDataTransferSettings consumerSettings = settings.getNodeSettings(consumer);
    setName(NLS.bind(CoreMessages.data_transfer_wizard_job_container_name, CommonUtils.truncateString(producer.getSourceObject().getName(), 200)));
    IDataTransferSettings nodeSettings = settings.getNodeSettings(producer);
    try {
        // consumer.initTransfer(producer.getSourceObject(), consumerSettings, );
        producer.transferData(monitor, consumer, nodeSettings);
        consumer.finishTransfer(monitor, false);
        return true;
    } catch (Exception e) {
        new DataTransferErrorJob(e).schedule();
        return false;
    }
}
Also used : IDataTransferSettings(org.jkiss.dbeaver.tools.transfer.IDataTransferSettings) IDataTransferConsumer(org.jkiss.dbeaver.tools.transfer.IDataTransferConsumer) IDataTransferProducer(org.jkiss.dbeaver.tools.transfer.IDataTransferProducer)

Example 4 with IDataTransferSettings

use of org.jkiss.dbeaver.tools.transfer.IDataTransferSettings in project dbeaver by dbeaver.

the class DataTransferPageFinal method activatePage.

@Override
public void activatePage() {
    resultTable.removeAll();
    DataTransferSettings settings = getWizard().getSettings();
    List<DataTransferPipe> dataPipes = settings.getDataPipes();
    for (DataTransferPipe pipe : dataPipes) {
        IDataTransferSettings consumerSettings = settings.getNodeSettings(pipe.getConsumer());
        IDataTransferProcessor processor = null;
        if (settings.getProcessor() != null) {
            // Processor is optional
            try {
                processor = settings.getProcessor().getInstance();
            } catch (Throwable e) {
                log.error("Can't create processor", e);
                continue;
            }
        }
        pipe.getConsumer().initTransfer(pipe.getProducer().getSourceObject(), consumerSettings, processor, processor == null ? null : settings.getProcessorProperties());
        TableItem item = new TableItem(resultTable, SWT.NONE);
        item.setText(0, DBUtils.getObjectFullName(pipe.getProducer().getSourceObject(), DBPEvaluationContext.UI));
        if (settings.getProducer() != null && settings.getProducer().getIcon() != null) {
            item.setImage(0, DBeaverIcons.getImage(settings.getProducer().getIcon()));
        }
        item.setText(1, pipe.getConsumer().getTargetName());
        if (settings.getProcessor() != null && settings.getProcessor().getIcon() != null) {
            item.setImage(1, DBeaverIcons.getImage(settings.getProcessor().getIcon()));
        } else if (settings.getConsumer() != null && settings.getConsumer().getIcon() != null) {
            item.setImage(1, DBeaverIcons.getImage(settings.getConsumer().getIcon()));
        }
    }
    activated = true;
    UIUtils.packColumns(resultTable, true);
    updatePageCompletion();
}
Also used : IDataTransferSettings(org.jkiss.dbeaver.tools.transfer.IDataTransferSettings) IDataTransferProcessor(org.jkiss.dbeaver.tools.transfer.IDataTransferProcessor) IDataTransferSettings(org.jkiss.dbeaver.tools.transfer.IDataTransferSettings) TableItem(org.eclipse.swt.widgets.TableItem)

Aggregations

IDataTransferSettings (org.jkiss.dbeaver.tools.transfer.IDataTransferSettings)4 TableItem (org.eclipse.swt.widgets.TableItem)2 IDataTransferConsumer (org.jkiss.dbeaver.tools.transfer.IDataTransferConsumer)2 IDataTransferProcessor (org.jkiss.dbeaver.tools.transfer.IDataTransferProcessor)2 IDataTransferProducer (org.jkiss.dbeaver.tools.transfer.IDataTransferProducer)2