Class SynchronizationServiceImpl
- java.lang.Object
-
- de.hybris.platform.cockpit.services.impl.AbstractServiceImpl
-
- de.hybris.platform.cockpit.services.sync.impl.SynchronizationServiceImpl
-
- All Implemented Interfaces:
SynchronizationService
- Direct Known Subclasses:
CMSSynchronizationService
public class SynchronizationServiceImpl extends AbstractServiceImpl implements SynchronizationService
Contains all necessary method responsible for synchronization activity- Spring Bean ID:
- synchronizationService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classSynchronizationServiceImpl.CockpitDummySyncConfiguratorprotected classSynchronizationServiceImpl.SyncContextImplprotected classSynchronizationServiceImpl.SyncInfo-
Nested classes/interfaces inherited from interface de.hybris.platform.cockpit.services.sync.SynchronizationService
SynchronizationService.SyncContext
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDISABLE_RESTRICTION-
Fields inherited from class de.hybris.platform.cockpit.services.impl.AbstractServiceImpl
modelService, typeService
-
Fields inherited from interface de.hybris.platform.cockpit.services.sync.SynchronizationService
INITIAL_SYNC_IS_NEEDED, SYNCHRONIZATION_NOT_AVAILABLE, SYNCHRONIZATION_NOT_OK, SYNCHRONIZATION_OK
-
-
Constructor Summary
Constructors Constructor Description SynchronizationServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckRootOrSubType(TypedObject item, SyncItemJob syncJob)java.util.Map<java.lang.String,java.lang.String>[]getAllSynchronizationRules(java.util.Collection items)Retrieves all matching synchronization rules (at first position - all accessible, at second position - all forbidden)CatalogManagergetCatalogManager()CatalogVersionModelgetCatalogVersionForItem(TypedObject item)Retrieves source catalog version for given itemprotected java.util.List<java.lang.String>getConfiguredReferenceTypes(TypedObject typedObject)Returns configured reference types.java.lang.LonggetLastTargetProductSyncTimestamp(Item product)Retrieves a time of last executed synchronization on the given productintgetPullSyncStatus(TypedObject product)protected java.util.List<TypedObject>getRelatedReferences(TypedObject typedObject)Retrieves all related references according to current configuration.protected intgetRelatedReferencesMaxDepth()protected java.util.Map<java.lang.String,java.util.List<java.lang.String>>getRelatedReferencesTypesMap()SynchronizationService.SyncContextgetSyncContext(TypedObject product)SynchronizationService.SyncContextgetSyncContext(TypedObject product, boolean pullSync)java.util.List<java.lang.String>getSynchronizationStatuses(java.util.List<SyncItemJobModel> rules, TypedObject sourceObject)Retrieves synchronization statuses for given itemjava.util.List<java.lang.String>getSynchronizationStatusesSimple(java.util.List<SyncItemJobModel> rules, TypedObject sourceObject)protected SynchronizationServiceImpl.SyncInfogetSyncInfo(TypedObject object)protected SynchronizationServiceImpl.SyncInfogetSyncInfoSimple(TypedObject object)java.util.List<SyncItemJobModel>[]getSyncJobs(ItemModel source, ObjectType objectType)Methods retrieves all matching catalog version (at first position - all accessible, at second position - all forbidden)java.util.Collection<TypedObject>getSyncSources(TypedObject object)Gets the all sync source objects.java.util.Collection<TypedObject>getSyncSourcesAndTargets(TypedObject object)java.util.Collection<TypedObject>getSyncTargets(TypedObject object)Gets the all sync targets.SystemServicegetSystemService()java.util.List<SyncItemJobModel>[]getTargetCatalogVersions(TypedObject item)Methods retrieves all matching catalog version (at first position - all accessible, at second position - all forbidden)TypeManagergetTypeManager()booleanhasMultipleRules(java.util.Collection items)Check whether some of passed items has ambigous synchronization ruleintisObjectSynchronized(TypedObject object)TODO FIXME - Find way to get appropriate synchronization status, condition that is used below is not correct.protected java.lang.BooleanisSearchRestrictionDisabled()Checks if the restrictions should be disabled for the internal search operations of the service.booleanisVersionSynchronizedAtLeastOnce(java.util.List list)Checks whether particular product version was synchronized at least once!voidperformCatalogVersionSynchronization(java.util.Collection<CatalogVersionModel> data, java.util.List<java.lang.String> syncRulePkList, CatalogVersionModel targetCatalogVersion, java.lang.String qualifier)Responsible for catalog version synchronization //TODO should be refactorvoidperformPullSynchronization(java.util.List<TypedObject> targetItems)java.util.Collection<TypedObject>performSynchronization(java.util.Collection<? extends java.lang.Object> items, java.util.List<java.lang.String> syncJobPkList, CatalogVersionModel targetCatalogVersion, java.lang.String qualifier)Method that runs particular synchronization<E extends TypedObject>
CatalogVersionretrieveCatalogVersion(E item)Retrieves source catalog version for given productvoidsetItemSyncTimestampDao(ItemSyncTimestampDao itemSyncTimestampDao)voidsetRelatedReferencesMaxDepth(int relatedReferencesMaxDepth)voidsetRelatedReferencesTypesMap(java.util.Map<java.lang.String,java.util.List<java.lang.String>> relatedReferencesTypesMap)voidsetSearchRestrictionsDisabled(boolean disabled)voidsetSynchronizationServiceDao(SynchronizationServiceDao synchronizationServiceDao)Sets the synchronization service DAO.voidsetSystemService(SystemService systemService)voidsetValueHandlerRegistry(ObjectValueHandlerRegistry valueHandlerRegistry)-
Methods inherited from class de.hybris.platform.cockpit.services.impl.AbstractServiceImpl
getEnum, getEnums, getLocalizedLabel, getLocalizedLabel, getModelService, getTypeService, setCockpitTypeService, setLabelResolver, setModelService
-
-
-
-
Field Detail
-
DISABLE_RESTRICTION
public static final java.lang.String DISABLE_RESTRICTION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRelatedReferencesTypesMap
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> getRelatedReferencesTypesMap()
-
setRelatedReferencesTypesMap
public void setRelatedReferencesTypesMap(java.util.Map<java.lang.String,java.util.List<java.lang.String>> relatedReferencesTypesMap)
-
getRelatedReferencesMaxDepth
protected int getRelatedReferencesMaxDepth()
-
setRelatedReferencesMaxDepth
public void setRelatedReferencesMaxDepth(int relatedReferencesMaxDepth)
-
getTypeManager
public TypeManager getTypeManager()
-
getCatalogManager
public CatalogManager getCatalogManager()
-
getSyncSources
public java.util.Collection<TypedObject> getSyncSources(TypedObject object)
Description copied from interface:SynchronizationServiceGets the all sync source objects.- Specified by:
getSyncSourcesin interfaceSynchronizationService- Parameters:
object- the object- Returns:
- the sync sources
-
getSyncTargets
public java.util.Collection<TypedObject> getSyncTargets(TypedObject object)
Description copied from interface:SynchronizationServiceGets the all sync targets.- Specified by:
getSyncTargetsin interfaceSynchronizationService- Parameters:
object- the object- Returns:
- the sync targets
-
getSyncSourcesAndTargets
public java.util.Collection<TypedObject> getSyncSourcesAndTargets(TypedObject object)
- Specified by:
getSyncSourcesAndTargetsin interfaceSynchronizationService
-
performPullSynchronization
public void performPullSynchronization(java.util.List<TypedObject> targetItems)
- Specified by:
performPullSynchronizationin interfaceSynchronizationService
-
performSynchronization
public java.util.Collection<TypedObject> performSynchronization(java.util.Collection<? extends java.lang.Object> items, java.util.List<java.lang.String> syncJobPkList, CatalogVersionModel targetCatalogVersion, java.lang.String qualifier)
Description copied from interface:SynchronizationServiceMethod that runs particular synchronization- Specified by:
performSynchronizationin interfaceSynchronizationService- Parameters:
items- - products passed for synchronizations- Returns:
- the collection of typed objects which were affected by the sync, i.e. which may need to be updated
-
retrieveCatalogVersion
public <E extends TypedObject> CatalogVersion retrieveCatalogVersion(E item)
Retrieves source catalog version for given product- Parameters:
item- - passed item
-
getPullSyncStatus
public int getPullSyncStatus(TypedObject product)
- Specified by:
getPullSyncStatusin interfaceSynchronizationService
-
isObjectSynchronized
public final int isObjectSynchronized(TypedObject object)
TODO FIXME - Find way to get appropriate synchronization status, condition that is used below is not correct. Maybe there are or will be some core mechanisms to achieve that! Checks whether given product is synchronized- Specified by:
isObjectSynchronizedin interfaceSynchronizationService- Parameters:
object- - passed item
-
getSyncInfo
protected SynchronizationServiceImpl.SyncInfo getSyncInfo(TypedObject object)
-
getSyncInfoSimple
protected SynchronizationServiceImpl.SyncInfo getSyncInfoSimple(TypedObject object)
-
isVersionSynchronizedAtLeastOnce
public boolean isVersionSynchronizedAtLeastOnce(java.util.List list)
Checks whether particular product version was synchronized at least once!- Specified by:
isVersionSynchronizedAtLeastOncein interfaceSynchronizationService
-
getLastTargetProductSyncTimestamp
public java.lang.Long getLastTargetProductSyncTimestamp(Item product)
Retrieves a time of last executed synchronization on the given product- Parameters:
product- - passed product- Returns:
- - time in milliseconds
-
isSearchRestrictionDisabled
protected java.lang.Boolean isSearchRestrictionDisabled()
Checks if the restrictions should be disabled for the internal search operations of the service. By default the method returnsTRUE. You can change this behavior by settingfalsevalue usingsetSearchRestrictionsDisabled(boolean)injection.
-
checkRootOrSubType
protected boolean checkRootOrSubType(TypedObject item, SyncItemJob syncJob)
-
getTargetCatalogVersions
public java.util.List<SyncItemJobModel>[] getTargetCatalogVersions(TypedObject item)
Description copied from interface:SynchronizationServiceMethods retrieves all matching catalog version (at first position - all accessible, at second position - all forbidden)- Specified by:
getTargetCatalogVersionsin interfaceSynchronizationService
-
getSyncJobs
public java.util.List<SyncItemJobModel>[] getSyncJobs(ItemModel source, ObjectType objectType)
Description copied from interface:SynchronizationServiceMethods retrieves all matching catalog version (at first position - all accessible, at second position - all forbidden)- Specified by:
getSyncJobsin interfaceSynchronizationService
-
getCatalogVersionForItem
public CatalogVersionModel getCatalogVersionForItem(TypedObject item)
Description copied from interface:SynchronizationServiceRetrieves source catalog version for given item- Specified by:
getCatalogVersionForItemin interfaceSynchronizationService- Parameters:
item- - passed item
-
getAllSynchronizationRules
public java.util.Map<java.lang.String,java.lang.String>[] getAllSynchronizationRules(java.util.Collection items)
Description copied from interface:SynchronizationServiceRetrieves all matching synchronization rules (at first position - all accessible, at second position - all forbidden)- Specified by:
getAllSynchronizationRulesin interfaceSynchronizationService- See Also:
SynchronizationService.getAllSynchronizationRules(java.util.Collection)
-
getSynchronizationStatuses
public java.util.List<java.lang.String> getSynchronizationStatuses(java.util.List<SyncItemJobModel> rules, TypedObject sourceObject)
Description copied from interface:SynchronizationServiceRetrieves synchronization statuses for given item- Specified by:
getSynchronizationStatusesin interfaceSynchronizationService- Parameters:
rules- - accessible synch rulessourceObject- - current checked object- Returns:
- list of primary keys
-
getSynchronizationStatusesSimple
public java.util.List<java.lang.String> getSynchronizationStatusesSimple(java.util.List<SyncItemJobModel> rules, TypedObject sourceObject)
-
performCatalogVersionSynchronization
public void performCatalogVersionSynchronization(java.util.Collection<CatalogVersionModel> data, java.util.List<java.lang.String> syncRulePkList, CatalogVersionModel targetCatalogVersion, java.lang.String qualifier)
Responsible for catalog version synchronization //TODO should be refactor- Specified by:
performCatalogVersionSynchronizationin interfaceSynchronizationService
-
hasMultipleRules
public boolean hasMultipleRules(java.util.Collection items)
Description copied from interface:SynchronizationServiceCheck whether some of passed items has ambigous synchronization rule- Specified by:
hasMultipleRulesin interfaceSynchronizationService- Parameters:
items- - passed items- See Also:
SynchronizationService.hasMultipleRules(java.util.Collection)
-
getSyncContext
public SynchronizationService.SyncContext getSyncContext(TypedObject product)
- Specified by:
getSyncContextin interfaceSynchronizationService
-
getSyncContext
public SynchronizationService.SyncContext getSyncContext(TypedObject product, boolean pullSync)
- Specified by:
getSyncContextin interfaceSynchronizationService
-
setSynchronizationServiceDao
public void setSynchronizationServiceDao(SynchronizationServiceDao synchronizationServiceDao)
Sets the synchronization service DAO.- Parameters:
synchronizationServiceDao- the synchronizationServiceDao to set
-
getRelatedReferences
protected java.util.List<TypedObject> getRelatedReferences(TypedObject typedObject)
Retrieves all related references according to current configuration. Note:
This method retrieves all related references that take a part into synch status computation.- Parameters:
typedObject- given object- Returns:
- related references
-
getConfiguredReferenceTypes
protected java.util.List<java.lang.String> getConfiguredReferenceTypes(TypedObject typedObject)
Returns configured reference types.- Parameters:
typedObject- given object- Returns:
- configured reference types
-
setSearchRestrictionsDisabled
public void setSearchRestrictionsDisabled(boolean disabled)
-
setItemSyncTimestampDao
public void setItemSyncTimestampDao(ItemSyncTimestampDao itemSyncTimestampDao)
-
getSystemService
public SystemService getSystemService()
-
setSystemService
public void setSystemService(SystemService systemService)
-
setValueHandlerRegistry
public void setValueHandlerRegistry(ObjectValueHandlerRegistry valueHandlerRegistry)
-
-