0
votes

I wonder where I can see the defined impex import order, I've see that every extension has it's own extensionNameSystemSetup.java where I can see some methods like:

@SystemSetup(type = SystemSetup.Type.PROJECT, process = SystemSetup.Process.ALL)
public void createProjectData(final SystemSetupContext context)
{
    final List<ImportData> importData = new ArrayList<ImportData>();

    final ImportData electronicsImportData = new ImportData();
    electronicsImportData.setProductCatalogName(ELECTRONICS);
    electronicsImportData.setContentCatalogNames(Arrays.asList(ELECTRONICS));
    electronicsImportData.setStoreNames(Arrays.asList(ELECTRONICS));
    importData.add(electronicsImportData);

    getCoreDataImportService().execute(this, context, importData);
    getEventService().publishEvent(new CoreDataImportedEvent(context, importData));

    getSampleDataImportService().execute(this, context, importData);
    getEventService().publishEvent(new SampleDataImportedEvent(context, importData));
}

However I don't see where the exact order of the impex is defined. How during the initialization Hybris knows that it must import the Products before importing the prices of the products?

1

1 Answers

1
votes

There is Service -->Abstract class AbstractDataImportService inside commerceservices extension. This class is again extended by SampleDataImportService and CoreDataImportService service.

SampleDataImportService is responsible to execute sample data of selected stores extension(like electronics,powertools) based on localextension.xml. and in this class execution hierarchy is maintained.

code snippet as below.

@Override
protected void importProductCatalog(final String extensionName, final String productCatalogName)
{
    // Load Units
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/classifications-units.impex", extensionName,
                    productCatalogName), false);

    // Load Categories
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/categories.impex", extensionName,
                    productCatalogName), false);

    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/categories-classifications.impex",
                    extensionName, productCatalogName), false);

    // Load Suppliers
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/suppliers.impex", extensionName,
                    productCatalogName), false);
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/suppliers-media.impex", extensionName,
                    productCatalogName), false);

    // Load medias for Categories as Suppliers loads some new Categories
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/categories-media.impex", extensionName,
                    productCatalogName), false);

    // Load Products
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products.impex", extensionName,
                    productCatalogName), false);
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-media.impex", extensionName,
                    productCatalogName), false);
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-classifications.impex", extensionName,
                    productCatalogName), false);

    // Load Products Relations
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-relations.impex", extensionName,
                    productCatalogName), false);

    // Load Products Fixes
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-fixup.impex", extensionName,
                    productCatalogName), false);

    // Load Prices
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-prices.impex", extensionName,
                    productCatalogName), false);

    // Load Stock Levels
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-stocklevels.impex", extensionName,
                    productCatalogName), false);
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-pos-stocklevels.impex", extensionName,
                    productCatalogName), false);

    // Load Taxes
    getSetupImpexService().importImpexFile(
            String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-tax.impex", extensionName,
                    productCatalogName), false);

    // Load Multi-Dimensial Products
    importMultiDProductCatalog(extensionName, productCatalogName);

}