Initialize import context

@param DataProviderInterface $dataProvider
@throws Exception
7110
public function initialize(DataProviderInterface $dataProvider)
    {
        $this->dataProvider = $dataProvider;
        $contextConfiguration = ['workspaceName' => 'live', 'invisibleContentShown' => true];
        $context = $this->contextFactory->create($contextConfiguration);
        $this->rootNode = $context->getRootNode();

        $this->applyOption($this->storageNodeNodePath, 'storageNodeNodePath');
        $this->applyOption($this->nodeTypeName, 'nodeTypeName');

        if (isset($this->options['siteNodePath']) || isset($this->options['siteNodeIdentifier'])) {
            $siteNodePath = isset($this->options['siteNodePath']) ? trim($this->options['siteNodePath']) : null;
            $siteNodeIdentifier = isset($this->options['siteNodeIdentifier']) ? trim($this->options['siteNodeIdentifier']) : null;
            $this->siteNode = $this->rootNode->getNode($siteNodePath) ?: $context->getNodeByIdentifier($siteNodeIdentifier);
            if ($this->siteNode === null) {
                throw new Exception(sprintf('Site node not found (%s)', $siteNodePath ?: $siteNodeIdentifier), 1425077201);
            }
        } else {
            $this->log(get_class($this) . ': siteNodePath is not defined. Please make sure to set the target siteNodePath in your importer options.', LOG_WARNING);
        }
    }
1135043
protected void setDataProvider(DataProvider provider) {
		if ((this.dataProvider != null)
				&& (this.dataProvider.getRefreshPolicy() == DataProvider.RefreshPolicy.ON_USER_SWITCH)) {
			getApplicationConfig()
					.applicationSession()
					.removePropertyChangeListener(ApplicationSession.USER, this);
		}

		this.dataProvider = provider;

		if ((this.dataProvider != null)
				&& (this.dataProvider.getRefreshPolicy() == DataProvider.RefreshPolicy.ON_USER_SWITCH)) {
			getApplicationConfig().applicationSession().addPropertyChangeListener(
					ApplicationSession.USER, this);
		}
	}
620608
protected function getDataTablesWrapper(DataTablesProviderInterface $dtProvider) {

        $url = $this->getDataTablesURL($dtProvider);

        $dtWrapper = DataTablesFactory::newWrapper($url, $dtProvider, $this->getKernelEventListener()->getUser());

        foreach ($dtProvider->getColumns() as $dtColumn) {

            $this->getLogger()->debug(sprintf("DataTables provider \"%s\" add a column \"%s\"", $dtProvider->getName(), $dtColumn->getData()));

            $dtWrapper->addColumn($dtColumn);
        }

        if (null !== $dtProvider->getOptions()) {
            $dtWrapper->setOptions($dtProvider->getOptions());
        }

        return $dtWrapper;
    }
362080
public function registerProvider(DataTablesProviderInterface $provider) {
        if (true === $this->exists($provider->getName())) {
            throw new AlreadyRegisteredDataTablesProviderException($provider->getName());
        }
        $this->index[$provider->getName()] = $this->size();
        return $this->addProvider($provider);
    }
1058276
public function initialize($dataSource)
    {
        $this->position = 0;
        $this->count    = null;

        if (is_array($dataSource)) {
            reset($dataSource);
            $this->dataSource = new ArrayIterator($dataSource);
        } elseif ($dataSource instanceof IteratorAggregate) {
            $this->dataSource = $dataSource->getIterator();
            $this->dataSource->rewind();
        } elseif ($dataSource instanceof Iterator) {
            $this->dataSource = $dataSource;
            $this->dataSource->rewind();
        } else {
            throw new Exception\InvalidArgumentException(
                'DataSource provided is not an array, nor does it implement Iterator or IteratorAggregate'
            );
        }

        return $this;
    }
1190841
public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createMerchantRelationshipDataImport()->import($dataImporterConfigurationTransfer);
    }
997794
public function importProductMeasurementUnit(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()
            ->getProductMeasurementUnitDataImporter()
            ->import($dataImporterConfigurationTransfer);
    }
452178
public function get(string $id): DataProviderInterface
    {
        if (!$this->has($id)) {
            throw new Exception('No data provider with id "'.$id.'" was loaded');
        }

        return $this->dataProviders[$id];
    }
1260408
public function importCompanyRoles(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createCompanyRoleDataImport()->import($dataImporterConfigurationTransfer);
    }
366476
public function init(BaseModelCriteria $criteria, DataFetcherInterface $dataFetcher = null)
    {
        $this->dbName = $criteria->getDbName();
        $this->setClass($criteria->getModelName());
        $this->setWith($criteria->getWith());
        $this->asColumns = $criteria->getAsColumns();
        $this->hasLimit = $criteria->getLimit() != -1;
        if ($dataFetcher) {
            $this->setDataFetcher($dataFetcher);
        }

        return $this;
    }
340479
public function importProductPackagingUnits(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createProductPackagingUnitDataImport()->import($dataImporterConfigurationTransfer);
    }
935956
public RuleContext<D> read(final DataProvider<D>... dataProviders) {
        if (dataProviders != null) {
            Collections.addAll(registeredDataProviders, dataProviders);
        }
        return this;
    }
356912
public function init()
    {
        if ($this->dataProvider === null) {
            throw new InvalidConfigException('The "dataProvider" property must be set');
        }
        $this->channelAttributes = $this->getAttributes($this->channel);
        foreach ($this->requiredChannelElements as $channelElement) {
            if (!in_array($channelElement, $this->channelAttributes)) {
                throw new InvalidConfigException('Required channel attribute "' . $channelElement . '" must be set');
            }
        }
        $this->itemAttributes = $this->getAttributes($this->items);
        foreach ($this->requiredItemElements as $itemElement) {
            if (!in_array($itemElement, $this->itemAttributes)) {
                throw new InvalidConfigException('Required item attribute "' . $itemElement . '" must be set');
            }
        }
        $this->feed = new Feed;
    }
669780
public <DPO> SingleDataProviderContext<DPO> read(DataProvider<DPO> dataProvider) {
        List<DataProvider<DPO>> addedDataProviders = new ArrayList<DataProvider<DPO>>();
        if (dataProvider != null) {
            addedDataProviders.add(dataProvider);
        }

        // Change context
        return new SingleDataProviderContext<DPO>(addedTriggers, addedDataProviders);
    }
778646
public function initializeContext(Context $context)
    {
        if (false === $context instanceof AliceContextInterface) {
            return;
        }

        /* @var AliceContextInterface $context */
        $fixturesBasePath = $this->fixturesBasePath;
        switch (true) {

            case $context instanceof AliceODMContext:
                $fixturesBasePath .= '/ODM';
                break;

            case $context instanceof AliceORMContext:
                $fixturesBasePath .= '/ORM';
                break;

            case $context instanceof AlicePHPCRContext:
                $fixturesBasePath .= '/PHPCR';
                break;
        }

        if (null === $context->getBasePath()) {
            $context->setBasePath($fixturesBasePath);
        }
    }
647801
public function initialize()
    {
        $app = $this->app;

        $include = $app->request->get('!include');
        if (!empty($include)) {
            Norm::options('include', true);
        }

        $tz = $app->request->get('!tz');
        if (!empty($tz)) {
            Norm::options('tz', $tz);
        }

        if (!isset($this->options['datasources'])) {
            $this->options['datasources'] = $this->app->config('norm.datasources');
        }

        // DEPRECATED: norm.databases deprecated
        if (!isset($this->options['datasources'])) {
            $this->options['datasources'] = $this->app->config('norm.databases');
        }

        if (!isset($this->options['datasources'])) {
            throw new \Exception('[Norm] No data source configuration. Append "norm.datasources" bono configuration!');
        }

        if (!isset($this->options['collections'])) {
            $this->options['collections'] = $this->app->config('norm.collections');
        }

        Norm::init($this->options['datasources'], $this->options['collections']);

        $controllerConfig = $this->app->config('bono.controllers');
        if (!isset($controllerConfig['default'])) {
            $controllerConfig['default'] = 'Norm\\Controller\\NormController';
        }
        $this->app->config('bono.controllers', $controllerConfig);

        if (! class_exists('Norm')) {
            class_alias('Norm\\Norm', 'Norm');
        }

        $d = explode(DIRECTORY_SEPARATOR.'src', __DIR__);
        $this->app->theme->addBaseDirectory($d[0], 10);
    }
769800
public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()
            ->getProductAlternativeDataImport()
            ->import($dataImporterConfigurationTransfer);
    }