From bbd296f197f60c3174d5b3fa0892c80b879a34da Mon Sep 17 00:00:00 2001 From: DenisSinelnikov <142215442+DenisSinelnikov@users.noreply.github.com> Date: Tue, 14 May 2024 20:18:08 +0400 Subject: [PATCH] CB-5007. Fixed import to mongo (#2612) * CB-5007. Fixed import to mongo * CB-5007. Fixed checkstyle --- .../transfer/impl/WebServiceDataTransfer.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/server/bundles/io.cloudbeaver.service.data.transfer/src/io/cloudbeaver/service/data/transfer/impl/WebServiceDataTransfer.java b/server/bundles/io.cloudbeaver.service.data.transfer/src/io/cloudbeaver/service/data/transfer/impl/WebServiceDataTransfer.java index b363879cc8..47ce955228 100644 --- a/server/bundles/io.cloudbeaver.service.data.transfer/src/io/cloudbeaver/service/data/transfer/impl/WebServiceDataTransfer.java +++ b/server/bundles/io.cloudbeaver.service.data.transfer/src/io/cloudbeaver/service/data/transfer/impl/WebServiceDataTransfer.java @@ -338,22 +338,17 @@ private void importData( DBRProgressMonitor monitor, DataTransferProcessorDescriptor processor, @NotNull DBSDataManipulator dataContainer, - Path path) throws DBException - { + Path path) throws DBException { IDataTransferProcessor processorInstance = processor.getInstance(); + StreamTransferProducer producer; if (dataContainer.getDataSource() != null) { - DatabaseTransferConsumer consumer = new DatabaseTransferConsumer(dataContainer); + producer = new StreamTransferProducer(new StreamEntityMapping(path), processor); + DatabaseTransferConsumer consumer = new DatabaseTransferConsumer(dataContainer); DatabaseConsumerSettings databaseConsumerSettings = new DatabaseConsumerSettings(); databaseConsumerSettings.setContainer((DBSObjectContainer) dataContainer.getDataSource()); consumer.setSettings(databaseConsumerSettings); - DatabaseMappingContainer databaseMappingContainer = new DatabaseMappingContainer(databaseConsumerSettings, dataContainer); - databaseMappingContainer.getAttributeMappings(monitor); - databaseMappingContainer.setTarget(dataContainer); - consumer.setContainerMapping(databaseMappingContainer); - - StreamTransferProducer producer = new StreamTransferProducer(new StreamEntityMapping(path), processor); StreamProducerSettings producerSettings = new StreamProducerSettings(); Map properties = new HashMap<>(); @@ -366,7 +361,11 @@ private void importData( producer, processorInstance, properties); - + DatabaseMappingContainer databaseMappingContainer = + new DatabaseMappingContainer(databaseConsumerSettings, producer.getDatabaseObject()); + databaseMappingContainer.getAttributeMappings(monitor); + databaseMappingContainer.setTarget(dataContainer); + consumer.setContainerMapping(databaseMappingContainer); try { producer.transferData(monitor, consumer, processorInstance, producerSettings, null); } catch (DBException e) {