Академический Документы
Профессиональный Документы
Культура Документы
CONFIDENTIAL
Page 1
Table of Contents
1
Introduction............................................................................................................................3
Steps......................................................................................................................................6
CONFIDENTIAL
Page 2
Introduction
The goal of this documents its introduce the new catalog structure multicountry in the
current system mono-country and add the new jobs of synchronization.
In order to create differents cases test has been created step impex to launch in local
environment.
Before lets show the entire new catalog structure, with focalization on job used for the
new flows of synchronization, and after the step to follow to ensure correct
functionality of new synchronization.
CONFIDENTIAL
Page 3
Catalog
Structure and
syncronization
This is the catalog structure with all the jobs syncronization:
Figura 1
CONFIDENTIAL
Page 4
Figura 2
CONFIDENTIAL
Page 5
Steps
The necessary step to realize data-migration are:
1) Turn off of all Hybris node Commerce.
2) Update with only hmwebservice checked
CONFIDENTIAL
Page 6
CONFIDENTIAL
Page 7
CONFIDENTIAL
Page 8
Go down to the Language section and right- click to open the language
window
CONFIDENTIAL
Page 9
CONFIDENTIAL
Page 10
10)
Stop all job with launch of this impex form HAC ->Console->Impex Import:
INSERT_UPDATE CronJob;code[unique=true];active;retry
;full-hm-franceProductOOBIndex-cronJob;false;false
;full-hm-franceCategoryIndex-cronJob;false;false
;full-hm-franceProductHMIndex-cronJob;false;false
;update-hm-franceCategoryIndex-cronJob;false;false
;update-hm-franceProductHMIndex-cronJob;false;false
;update-hm-franceProductOOBIndex-cronJob;false;false
;full-hm-italyProductOOBIndex-cronJob;false;false
;full-hm-italyCategoryIndex-cronJob;false;false
;full-hm-italyProductHMIndex-cronJob;false;false
;update-hm-italyCategoryIndex-cronJob;false;false
;update-hm-italyProductHMIndex-cronJob;false;false
;update-hm-italyProductOOBIndex-cronJob;false;false
;full-hm-spainProductOOBIndex-cronJob;false;false
CONFIDENTIAL
Page 11
;full-hm-spainCategoryIndex-cronJob;false;false
;full-hm-spainProductHMIndex-cronJob;false;false
;update-hm-spainCategoryIndex-cronJob;false;false
;update-hm-spainProductHMIndex-cronJob;false;false
;update-hm-spainProductOOBIndex-cronJob;false;false
;full-hm-portugalProductOOBIndex-cronJob;false;false
;full-hm-portugalCategoryIndex-cronJob;false;false
;full-hm-portugalProductHMIndex-cronJob;false;false
;update-hm-portugalCategoryIndex-cronJob;false;false
;update-hm-portugalProductHMIndex-cronJob;false;false
;update-hm-portugalProductOOBIndex-cronJob;false;false
;full-hm-chinaProductOOBIndex-cronJob;false;false
;full-hm-chinaCategoryIndex-cronJob;false;false
;full-hm-chinaProductHMIndex-cronJob;false;false
;update-hm-chinaCategoryIndex-cronJob;false;false
;update-hm-chinaProductHMIndex-cronJob;false;false
;update-hm-chinaProductOOBIndex-cronJob;false;false
;paymentProcessCronJob;false;false
INSERT_UPDATE MulticountryCronJob;code[unique=true];active;retry
;asiaChangeOrderStatusCronJob;false;false
;europeChangeOrderStatusCronJob;false;false
;asiaOrderBlindReturnsImportJob;false;false
;europeOrderBlindReturnsImportJob;false;false
;europeOrderToSAPExportJob;false;false
;europeConsignmentExportJob;false;false
;asiaConsignmentExportJob;false;false
;asiaStockAdjustmentDataLoaderCronJob;false;false
;europeStockAdjustmentDataLoaderCronJob;false;false
INSERT_UPDATE CronJob;code[unique=true];active;retry
#;stockAdjustmentDataLoaderCronJob;false;false
;Cluster 0: Lucenesearch-RebuildIndex-Job;false;false
;Cluster 0: Lucenesearch-UpdateIndex-Job;false;false
;subscriberUserExporterJob;false;false
;imagesImportCronJob;false;false
;fullCustomerExportCronJob;false;false
;orderHistoryExportJob;false;false
;stockDailySnapshotCronJob;false;false
;importCatalogCronJob;false;false
;orderSettlementJob;false;false
;consignmentCreationJob;false;false
;pendingPaymentCheckCronJob;false;false
CONFIDENTIAL
Page 12
11)
Reclamation of data for france-store to adapt them with new structure
multicountry
a. Launch of Beanshell PriceRow Reclamation (for france) from HAC>Console->BeanShell(whit commit activated):
import
import
import
import
import
import
import
import
import
import
import
import
import
import
goep.hm.multicountry.model.productavailabilitygroup.ProductAvailabilityGroupModel;
java.util.Collection;
org.apache.log4j.Logger;
de.hybris.platform.catalog.CatalogVersionService;
de.hybris.platform.catalog.model.CatalogVersionModel;
de.hybris.platform.core.Registry;
de.hybris.platform.europe1.enums.UserPriceGroup;
de.hybris.platform.europe1.model.PriceRowModel;
de.hybris.platform.servicelayer.model.ModelService;
de.hybris.platform.servicelayer.search.FlexibleSearchQuery;
de.hybris.platform.servicelayer.search.FlexibleSearchService;
de.hybris.platform.servicelayer.search.SearchResult;
de.hybris.platform.store.services.BaseStoreService;
goep.hm.multicountry.services.MulticountryRestrictionService;
CONFIDENTIAL
Page 13
CONFIDENTIAL
Page 14
totalResultQuery = productWithPriceRowResult.getResult().size();
Integer currentPercentage= Integer.valueOf(0);
for (Object obj : productWithPriceRowResult.getResult()) {
totalCounter++;
ProductModel p = (ProductModel) obj;
try {
//Set white price
if(p.getWhitePrice()!= null){
//log.info("TEST p.getWhitePrice():
"+p.getWhitePrice().getPrice());
modelService.clone(currentPR);
newItPR.setUg(upgIt);
modelService.save(newItPR);
counterIt++;
//ES
PriceRowModel newEsPR =
modelService.clone(currentPR);
newEsPR.setUg(upgEs);
modelService.save(newEsPR);
counterEs++;
}
} catch (Exception e) {
log.info("Exception for product " +p.getCode()+";
"+e.getMessage());
counterExceptions++;
}
totalPercentage = ( Double.valueOf(totalCounter) /
Double.valueOf(totalResultQuery))* 100;
if(currentPercentage<totalPercentage.intValue()){
currentPercentage=totalPercentage.intValue();
log.info("Progress: "+totalPercentage.intValue()+"% --"+totalCounter+" Products of "+totalResultQuery+" total Products scanned");
}
}
log.info("PriceRows IT correctly created: "+counterIt);
log.info("PriceRows ES correctly created: "+counterEs);
log.info("Exception encountered: "+counterExceptions);
log.info("BeanShellCreateEuropeWhitePriceRow FINISHED");
System.out.println("Exception encountered: "+counterExceptions);
System.out.println("PriceRows IT correctly created: "+counterIt);
System.out.println("PriceRows ES correctly created: "+counterEs);
System.out.println("BeanShellCreateEuropeWhitePriceRow FINISHED");
CONFIDENTIAL
Page 15
CONFIDENTIAL
Page 16
CONFIDENTIAL
Page 17
12)
Launch of Synchronization from Europe to Master (J1 in figura 1 above)
From HMC -> Catalog->Catalog Management Tools-Syncronization:
Select hm-europeProduct and click on next. Then select J1 one shot record and
start:
CONFIDENTIAL
Page 18
13)
Launch of beanshell to remove the relation between catalogs Master and
Europe, from HAC->Console->BeanShell(launch it with 50000 batchSize at a
time):
import de.hybris.platform.jalo.user.UserManager;
import de.hybris.platform.jalo.user.User;
import de.hybris.platform.jalo.JaloSession;
import de.hybris.platform.core.Registry;
import de.hybris.platform.catalog.model.ItemSyncTimestampModel;
import de.hybris.platform.servicelayer.search.FlexibleSearchService;
import de.hybris.platform.servicelayer.search.FlexibleSearchQuery;
import de.hybris.platform.servicelayer.search.SearchResult;
import de.hybris.platform.servicelayer.model.ModelService;
import java.util.List;
import org.apache.log4j.Logger;
/*************************************************
* SCRIPT VARIABLES
*
*************************************************/
Logger log = Logger.getLogger( " BeanShellRemoveRelation" );
String sourceCatalog = "hm-europeProductCatalog";
String sourceCatalogVersion = "Staged";
String targetCatalog = "hm-masterProductCatalog";
String targetCatalogVersion = "Staged";
int startCounter = 0;
int batchSize = 50000;
/*************************************************
* SCRIPT SERVICES
*
*************************************************/
FlexibleSearchService fss =
(FlexibleSearchService)Registry.getApplicationContext().getBean("flexibleSearchService");
ModelService ms = (ModelService)Registry.getApplicationContext().getBean("modelService");
/*************************************************
* SCRIPT BODY
*
*************************************************/
log.info("STARTED BeanShellRemoveRelation");
out.println("#BeanShell now is executed with user rights:" + JaloSession.getCurrentSession().getUser());
log.info("#BeanShell now is executed with user rights:" + JaloSession.getCurrentSession().getUser());
User previousUser = JaloSession.getCurrentSession().getUser();
JaloSession.getCurrentSession().setUser(UserManager.getInstance().getAdminEmployee());
out.println("fetching orphaned ItemSyncTimeStamp(s)");
log.info("fetching orphaned ItemSyncTimeStamp(s)");
/*
* The aim of the query is to extract all the ItemSyncTimestamps that has the wrong
* catalog set as source
*/
String query = " SELECT {ist.pk} FROM {ItemSyncTimestamp AS ist JOIN CatalogVersion AS
sourceCatalogVersion ON {ist.sourceVersion}={sourceCatalogVersion.pk} JOIN CatalogVersion AS
targetCatalogVersion ON {ist.targetVersion}={targetCatalogVersion.pk} JOIN Catalog AS sourceCatalog ON
CONFIDENTIAL
Page 19
14)
Launch of Synchronization from Europe Staged to Europe online(J4 in
figura 2 above)
From HMC -> Catalog->Catalog Management Tools-Syncronization:
Select hm-europeProduct and click on next. Then select J7 record and start:
15)
Launch of queries for hmsize before start the indexing process, from
HAC->FlexibleSearch and tab SQL Query(launch one query at a time):
CONFIDENTIAL
Page 20
UPDATE hmsize SET p_marketcode = (SELECT p_code FROM hmmarket WHERE hmsize.p_market =
hmmarket.pk)
UPDATE products SET (p_sizeCode, p_sizeScaleCode) = (SELECT p_sizeCode, p_sizeScaleCode FROM hmsize
WHERE products.p_hmsize = hmsize.pk)
16)
17)
CONFIDENTIAL
Page 21
}
catch(Exception ex){
LOG.error("It is impossible to save product model " +
productModel.getCode() + " and product group " + productGroupModel.getCode());
errorCodes.add("[" + productModel.getCode() + ", " +
productGroupModel.getCode() + "]");
}
}else{
LOG.info("Price marker of " + productGroupModel.getCode() + " is null and
we don't move it");
}
}
LOG.info("Product with error: " + errorCodes);
LOG.info("BeanShell Move Promotional Marker - End");
CONFIDENTIAL
Page 22
de.hybris.platform.servicelayer.search.FlexibleSearchService
flexibleSearchService =
(de.hybris.platform.servicelayer.search.FlexibleSearchService)
de.hybris.platform.core.Registry.getApplicationContext().getBean("flexibleSearchS
ervice");
de.hybris.platform.servicelayer.model.ModelService modelService =
(de.hybris.platform.servicelayer.model.ModelService)
de.hybris.platform.core.Registry.getApplicationContext().getBean("modelService")
;
de.hybris.platform.servicelayer.media.MediaService mediaService =
(de.hybris.platform.servicelayer.media.MediaService)
de.hybris.platform.core.Registry.getApplicationContext().getBean("mediaService")
;
LOG.info("Run query: " + query);
de.hybris.platform.servicelayer.search.SearchResult result =
flexibleSearchService.search(query);
java.util.List errorCodes = new java.util.ArrayList();
for(goep.hm.core.model.HMMarkerModel marker : result.getResult()){
de.hybris.platform.core.model.media.MediaModel mediaModel =
marker.getImage();
if(mediaModel != null) {
LOG.info("Change image for marker image: " +
mediaModel);
try{
java.io.FileInputStream inputStream = new
java.io.FileInputStream(new java.io.File(fileName));
mediaService.setStreamForMedia(mediaModel,
inputStream);
try{
modelService.save(mediaModel);
}
catch(Exception ex){
LOG.error("It is impossible to save product
model " + mediaModel.getName());
errorCodes.add(mediaModel.getName());
}
}
catch(Exception ex){
LOG.error("It is impossible to load image: " + ex);
}
}
else{
LOG.error("Marker " + marker + " hasn't got image!");
}
}
}
catch(java.io.IOException ex){
LOG.error("Error: " + ex);
}
LOG.info("Marker with error: " + errorCodes);
LOG.info("BeanShell Change Promotional Marker Image - End");
18)
Launch of Full indexing hm-franceProductHMIndex, from HMC -> System>Facet search->Indexer operation wizard:
CONFIDENTIAL
Page 23
Then click start and monitoring the by solr web interface the related master
index:
you can use firefox with proxy activate, like this:
CONFIDENTIAL
Page 24
CONFIDENTIAL
Page 25
I053_PickupPointDat
aLoad_3PP01_20140731041803850.csv
19)
Upload file
in the folder /mnt/integration/esbhybris/esb/out/i053/pending/
And run the job pointOfServiceDataLoaderCronJob;
20)
INSERT_UPDATE CronJob;code[unique=true];active;retry
;full-hm-franceProductOOBIndex-cronJob;true;true
;full-hm-franceCategoryIndex-cronJob;true;true
;full-hm-franceProductHMIndex-cronJob;true;true
;update-hm-franceCategoryIndex-cronJob;true;true
;update-hm-franceProductHMIndex-cronJob;true;true
;update-hm-franceProductOOBIndex-cronJob;true;true
;full-hm-italyProductOOBIndex-cronJob;true;true
;full-hm-italyCategoryIndex-cronJob;true;true
;full-hm-italyProductHMIndex-cronJob;true;true
;update-hm-italyCategoryIndex-cronJob;true;true
;update-hm-italyProductHMIndex-cronJob;true;true
;update-hm-italyProductOOBIndex-cronJob;true;true
;full-hm-spainProductOOBIndex-cronJob;true;true
;full-hm-spainCategoryIndex-cronJob;true;true
;full-hm-spainProductHMIndex-cronJob;true;true
;update-hm-spainCategoryIndex-cronJob;true;true
;update-hm-spainProductHMIndex-cronJob;true;true
;update-hm-spainProductOOBIndex-cronJob;true;true
;full-hm-portugalProductOOBIndex-cronJob;true;true
;full-hm-portugalCategoryIndex-cronJob;true;true
;full-hm-portugalProductHMIndex-cronJob;true;true
;update-hm-portugalCategoryIndex-cronJob;true;true
;update-hm-portugalProductHMIndex-cronJob;true;true
;update-hm-portugalProductOOBIndex-cronJob;true;true
;full-hm-chinaProductOOBIndex-cronJob;true;true
;full-hm-chinaCategoryIndex-cronJob;true;true
;full-hm-chinaProductHMIndex-cronJob;true;true
;update-hm-chinaCategoryIndex-cronJob;true;true
;update-hm-chinaProductHMIndex-cronJob;true;true
;update-hm-chinaProductOOBIndex-cronJob;true;true
;paymentProcessCronJob;true;true
INSERT_UPDATE MulticountryCronJob;code[unique=true];active;retry
;asiaChangeOrderStatusCronJob;true;true
;europeChangeOrderStatusCronJob;true;true
CONFIDENTIAL
Page 26
;asiaOrderBlindReturnsImportJob;true;true
;europeOrderBlindReturnsImportJob;true;true
;europeOrderToSAPExportJob;true;true
;europeConsignmentExportJob;true;true
;asiaConsignmentExportJob;true;true
;asiaStockAdjustmentDataLoaderCronJob;true;true
;europeStockAdjustmentDataLoaderCronJob;true;true
INSERT_UPDATE CronJob;code[unique=true];active;retry
#;stockAdjustmentDataLoaderCronJob;true;true
;Cluster 0: Lucenesearch-RebuildIndex-Job;true;true
;Cluster 0: Lucenesearch-UpdateIndex-Job;true;true
;subscriberUserExporterJob;true;true
;imagesImportCronJob;true;true
;fullCustomerExportCronJob;true;true
;orderHistoryExportJob;true;true
;stockDailySnapshotCronJob;true;true
;importCatalogCronJob;true;true
;orderSettlementJob;true;true
;consignmentCreationJob;true;true
;pendingPaymentCheckCronJob;true;true
21)
Set the property is.migration to false
in HAC ->Console->Configuration, by searching the name of property:
22)
Update with only hmcore checked and with sync Products & Content
Catalogs setted to no, to remove all no longer used sync-jobs:
23)
Launch of Synchronization from Master to Asia (J3 in figura 1 above)
CONFIDENTIAL
June 24st, 2014
Page 27
Select hm-masterProduct and click next. Then select J3 record and start:
24)
Launch of Synchronization from Asia Staged to Asia Online (J5 in figura 2
above)
From HMC -> Catalog->Catalog Management Tools-Syncronization:
Select hm-asiaProduct and click next. Then select J4 record and start:
CONFIDENTIAL
Page 28
CONFIDENTIAL
Page 29