public abstract class GenericCatalogCopyContext extends AbstractItemCopyContext
| Modifier and Type | Class and Description |
|---|---|
static class |
GenericCatalogCopyContext.AbstractParentResolver |
class |
GenericCatalogCopyContext.ReferenceParentResolver |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
LEGACY_MODE_FLAG |
static java.lang.String |
PARTIAL_COLLECTION_TRANSLATION_ALLOWED |
ctx| Constructor and Description |
|---|
GenericCatalogCopyContext(SessionContext ctx,
CatalogVersionSyncJob job,
CatalogVersionSyncCronJob cronJob,
Level logLevel,
boolean forceUpdate) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addCreationAttribute(AttributeDescriptor attributeDescriptor) |
protected void |
afterCopying(Item copy,
CatalogItemCopyCreator icc) |
protected void |
afterCreate(ItemCopyCreator icc,
Item ret)
Called during
ItemCopyCreator.copy(GenericCatalogCopyContext) right after a new item has been created but
before it's partOf items or references have been processed! |
protected void |
beforeCopying(CatalogItemCopyCreator icc) |
protected boolean |
canBeTranslatedPartially(AttributeCopyCreator attributeCopyCreator) |
void |
cleanup() |
protected java.util.Set<Item> |
collectPartOfItemsToCopy(AttributeCopyCreator acc) |
protected YLongToObjectMap<java.util.Set<de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ParentResolver>> |
computeDependentItemResolvers() |
protected boolean |
computeIsCopyOnDemand(AttributeDescriptor attributeDescriptor) |
protected java.util.Collection<de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ParentResolver> |
computeParentResolvers(ComposedType parentType,
java.util.Set<ComposedType> ctControlSet,
java.util.Set<AttributeDescriptor> adControlSet) |
Item |
copy(Item original) |
protected Item |
copy(ItemCopyCreator parent,
Item original) |
protected Item |
copy(ItemCopyCreator parent,
Item original,
Item copyToUpdate,
ItemSyncTimestamp itemSyncTimestamp) |
Item |
copy(Item original,
Item existingCopy,
ItemSyncTimestamp itemSyncTimestamp) |
protected void |
copyMediaData(Media src,
Media tgt) |
protected java.util.Map<Item,Item> |
copyPartOfValues(AttributeCopyCreator acc)
Tries to copy all items from
AttributeCopyCreator.getPartOfItemsToCopy(). |
protected AttributeCopyCreator |
createAttributeCopyCreator(ItemCopyCreator icc,
AttributeCopyDescriptor acd,
boolean ispreset,
java.lang.Object sourceValue) |
protected CatalogItemCopyCreator |
createCreator(ItemCopyCreator parent,
Item source,
Item target,
ItemSyncTimestamp itemSyncTimestamp,
java.util.Collection<java.lang.String> blacklist,
java.util.Collection<java.lang.String> whiteList,
java.util.Map<java.lang.String,java.lang.Object> presetValues) |
protected ItemSyncTimestamp |
createSyncTimestamp(CatalogVersionSyncCronJob owningCronJob,
int currentTurn,
Item source,
ItemCopyCreator icc)
Creates a new ItemSyncTimestamp based on the current context and parameters.
|
protected void |
finishedCopying(ItemCopyCreator icc)
Superclass method overridden to call
setTimestamp(CatalogVersionSyncCronJob, int, CatalogItemCopyCreator)
for each copied item. |
boolean |
forceCopy(AttributeDescriptor attributeDescriptor) |
protected YLongToObjectMap<java.util.Set<java.lang.String>> |
getCatalogKeyAttributesCache() |
protected CatalogVersion |
getCatalogVersion(Item item)
Returns the
CatalogVersion for the given Item. |
protected java.lang.String |
getCatalogVersionAttribute(ComposedType composedType) |
protected YLongToObjectMap<java.lang.String> |
getCatalogVersionAttributeCache() |
protected java.util.Set<ComposedType> |
getContainedCatalogItemTypes(AttributeDescriptor attributeDescriptor) |
protected java.util.Map<PK,de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry> |
getCopiedItemCache(boolean create) |
protected de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry |
getCopy(Item source) |
long |
getCopyCacheHits() |
long |
getCopyCacheMisses() |
int |
getCopyCacheSize() |
protected java.util.Set |
getCopyCreatorBlacklist(Item original,
Item toUpdate) |
protected java.util.Map |
getCopyCreatorPresetValues(Item original,
Item copyToupdate)
|
protected java.util.Set |
getCopyCreatorWhitelist(Item original,
Item toUpdate) |
protected YLongToByteMap |
getCopyOnDemandCache() |
protected Item |
getCounterpartItem(Item original) |
protected java.util.Set<AttributeDescriptor> |
getCreationAttributes()
Makes sure the following attribute are set during item creation although they are item references (normally item
references are translated and set after creating the copy):
GeneratedCatalogConstants.Attributes.Product.CATALOGVERSION
CatalogConstants.Attributes.Category.CATALOGVERSION
GeneratedCatalogConstants.Attributes.Media.CATALOGVERSION
GeneratedKeyword.CATALOGVERSION
GeneratedCatalogConstants.Attributes.Product.VARIANTTYPE
GeneratedVariantProduct.BASEPRODUCT
GeneratedProduct.UNIT
|
protected CatalogVersionSyncCronJob |
getCronjob() |
protected CatalogItemCopyCreator |
getCurrentlyCopying(Item original) |
protected abstract int |
getCurrentTurn() |
protected YLongToObjectMap<java.util.Set<de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ParentResolver>> |
getDependentItemResolverCache() |
java.util.Set<ComposedType> |
getDependentItemTypes() |
protected YLongToByteMap |
getIsCatalogTypeCache() |
protected CatalogVersionSyncJob |
getJob() |
protected java.util.Set<java.lang.String> |
getNonCatalogItemUniqueAttributes(ComposedType composedType) |
protected YLongToObjectMap<java.util.Set<java.lang.String>> |
getNonCatalogKeyAttributesCache() |
protected java.lang.String |
getRootCatalogType(ComposedType composedType) |
protected YLongToObjectMap<java.lang.String> |
getRootCatalogTypeCache() |
protected java.lang.String |
getRootUniqueItemType(ComposedType composedType,
java.util.Set<java.lang.String> uniqueAttributes) |
CatalogVersion |
getSourceVersion() |
protected java.util.Set<Language> |
getTargetLanguages() |
CatalogVersion |
getTargetVersion() |
protected CatalogVersion |
getTargetVersionForQueryCatalogItemCopy(Item sourceItem) |
protected java.util.Set<java.lang.String> |
getUniqueKeyAttributes(ComposedType composedType) |
protected SynchronizationPersistenceAdapter |
initPersistenceAdapter() |
protected boolean |
isCatalogItem(Item item) |
protected boolean |
isCatalogItemType(ComposedType composedType) |
protected boolean |
isCopyOnDemand(AttributeDescriptor attributeDescriptor) |
protected boolean |
isCopyOnDemandCatalogItemType(ComposedType catalogItemType,
java.lang.Class jaloClass) |
protected boolean |
isCurrentlyCopying(Item original) |
boolean |
isDependentFromSourceVersion(Item dependentItem) |
boolean |
isExclusiveMode()
If true the syncjob is added to the
ItemSyncTimestamp |
protected boolean |
isForceUpdate() |
boolean |
isFromSourceVersion(Item item)
Determines whether or not an item belongs to this contexts source version.
|
protected boolean |
isPartialCollectionTranslationEnabledGlobally() |
protected boolean |
isRequiredForCreation(AttributeDescriptor attributeDescriptor)
Determines whether or not a attribute is required for the creation of a item copy.
|
boolean |
isSavePrevousValues() |
boolean |
isStarted() |
protected boolean |
isUntranslatablePartOfItem(AttributeCopyCreator acc,
Item original)
Superclass method overridden to avoid copying catalog items which do not originate from the source
version.
|
protected boolean |
isUntranslatableProductFeature(ProductFeature productFeature) |
protected void |
logSavedValues(ItemCopyCreator icc) |
protected boolean |
mayBeCatalogItemDependent(ComposedType composedType) |
protected boolean |
mayBeCatalogItemDependent(Item item) |
protected boolean |
mustBeTranslated(AttributeCopyCreator acc,
Item original)
Makes sure each catalog items must always be translated.
|
protected boolean |
mustBeTranslated(java.lang.String attributeQualifier,
Item original) |
protected void |
popCurrentlyCopying(CatalogItemCopyCreator icc) |
protected de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry |
processQueryResult(Item sourceItem,
java.util.List<Item> rows,
java.util.List<java.lang.Object> keys) |
protected void |
pushCurrentlyCopying(CatalogItemCopyCreator icc) |
protected de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry |
queryCatalogItemCopy(Item sourceItem) |
protected de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry |
queryCopy(Item source) |
protected ItemSyncTimestamp |
queryExistingSyncTimestamp(Item src,
PK tgtPK)
Returns the ItemSyncTimestamp which has the given Item as source and the given PK as targetPK.
|
protected de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry |
queryNonCatalogItemCopy(Item source) |
protected void |
registerCopy(de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry copyInfo) |
void |
setCategoryOptions(boolean copyProducts,
boolean copySubcategories)
Sets special options for copying categories:
copyProducts - all products of a explicitly copied category are copied as well
copySubcategories - all sub categories of a explicitly copied category are copied as well
|
void |
setCopyCacheHits(long copyCacheHits) |
void |
setCopyCacheMisses(long copyCacheMisses) |
void |
setCopyCacheSize(int copyCacheSize) |
protected void |
setSavePrevousValues(boolean setSaveToOn) |
protected void |
setTargetLanguages(java.util.Collection<Language> languages) |
protected ItemSyncTimestamp |
setTimestamp(CatalogVersionSyncCronJob owningCronJob,
int currentTurn,
CatalogItemCopyCreator icc)
Registers the source item's modification time stamp inside a
ItemSyncTimestamp instance to allow checking
for modifications later. |
protected java.lang.Object |
translate(AttributeCopyCreator acc)
Filters localized attribute values by available catalog languages.
|
protected java.lang.String |
translateAD(AttributeDescriptor attributeDescriptor) |
protected Item |
translateItemValue(AttributeCopyCreator acc,
Item original,
java.util.Map<Item,Item> partOfItemsToBeCopied) |
protected java.lang.Object |
translateValue(AttributeCopyCreator acc,
java.lang.Object original,
java.util.Map<Item,Item> partOfItemsToBeCopied,
boolean localized) |
protected void |
updateSyncTimestamp(ItemSyncTimestamp itemSyncTimestamp,
CatalogVersionSyncCronJob owningCronJob,
int currentTurn,
Item source,
ItemCopyCreator icc)
Updates the given ItemSyncTimestamp based on the given parameters.
|
allItems, createCopyDescriptor, createSession, debug, error, getCatalogManager, getCtx, getFlexibleSearch, getSession, getTypeCopyDescriptor, ignoreAttribute, info, isAtomic, isAtomic, isDebugEnabled, isErrorEnabled, isInfoEnabled, isPartOf, isWarnEnabled, log, safeToString, splitDescriptors, toItem, toItems, toString, valuesToString, warnpublic static final java.lang.String LEGACY_MODE_FLAG
public static final java.lang.String PARTIAL_COLLECTION_TRANSLATION_ALLOWED
public GenericCatalogCopyContext(SessionContext ctx, CatalogVersionSyncJob job, CatalogVersionSyncCronJob cronJob, Level logLevel, boolean forceUpdate)
ctx - protected SynchronizationPersistenceAdapter initPersistenceAdapter()
protected void setTargetLanguages(java.util.Collection<Language> languages)
protected YLongToByteMap getIsCatalogTypeCache()
public java.util.Set<ComposedType> getDependentItemTypes()
protected YLongToObjectMap<java.util.Set<de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ParentResolver>> getDependentItemResolverCache()
protected boolean mayBeCatalogItemDependent(Item item)
protected boolean mayBeCatalogItemDependent(ComposedType composedType)
protected boolean isCatalogItem(Item item)
protected boolean isCatalogItemType(ComposedType composedType)
public void setCategoryOptions(boolean copyProducts,
boolean copySubcategories)
public final CatalogVersion getSourceVersion()
public final CatalogVersion getTargetVersion()
protected CatalogVersionSyncJob getJob()
public boolean isExclusiveMode()
ItemSyncTimestampprotected CatalogVersionSyncCronJob getCronjob()
protected abstract int getCurrentTurn()
public boolean isFromSourceVersion(Item item) throws JaloInvalidParameterException
item - the item to checkJaloInvalidParameterException - if the item is no catalog itemprotected CatalogVersion getCatalogVersion(Item item) throws JaloInvalidParameterException
CatalogVersion for the given Item.JaloInvalidParameterExceptionprotected java.lang.Object translate(AttributeCopyCreator acc)
protected void finishedCopying(ItemCopyCreator icc)
setTimestamp(CatalogVersionSyncCronJob, int, CatalogItemCopyCreator)
for each copied item.protected CatalogItemCopyCreator createCreator(ItemCopyCreator parent, Item source, Item target, ItemSyncTimestamp itemSyncTimestamp, java.util.Collection<java.lang.String> blacklist, java.util.Collection<java.lang.String> whiteList, java.util.Map<java.lang.String,java.lang.Object> presetValues)
protected ItemSyncTimestamp setTimestamp(CatalogVersionSyncCronJob owningCronJob, int currentTurn, CatalogItemCopyCreator icc)
ItemSyncTimestamp instance to allow checking
for modifications later.icc - the finished copy createdprotected void updateSyncTimestamp(ItemSyncTimestamp itemSyncTimestamp, CatalogVersionSyncCronJob owningCronJob, int currentTurn, Item source, ItemCopyCreator icc)
protected ItemSyncTimestamp createSyncTimestamp(CatalogVersionSyncCronJob owningCronJob, int currentTurn, Item source, ItemCopyCreator icc)
protected ItemSyncTimestamp queryExistingSyncTimestamp(Item src, PK tgtPK)
protected boolean mustBeTranslated(AttributeCopyCreator acc, Item original)
protected boolean mustBeTranslated(java.lang.String attributeQualifier,
Item original)
protected YLongToObjectMap<java.util.Set<de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ParentResolver>> computeDependentItemResolvers()
protected java.util.Collection<de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ParentResolver> computeParentResolvers(ComposedType parentType, java.util.Set<ComposedType> ctControlSet, java.util.Set<AttributeDescriptor> adControlSet)
public boolean isDependentFromSourceVersion(Item dependentItem)
protected java.util.Map getCopyCreatorPresetValues(Item original, Item copyToupdate)
protected YLongToObjectMap<java.lang.String> getRootCatalogTypeCache()
protected YLongToObjectMap<java.lang.String> getCatalogVersionAttributeCache()
protected YLongToObjectMap<java.util.Set<java.lang.String>> getCatalogKeyAttributesCache()
protected YLongToObjectMap<java.util.Set<java.lang.String>> getNonCatalogKeyAttributesCache()
protected YLongToByteMap getCopyOnDemandCache()
protected java.lang.String getCatalogVersionAttribute(ComposedType composedType)
protected java.lang.String getRootCatalogType(ComposedType composedType)
protected java.lang.String getRootUniqueItemType(ComposedType composedType, java.util.Set<java.lang.String> uniqueAttributes)
protected java.util.Set<java.lang.String> getUniqueKeyAttributes(ComposedType composedType)
protected java.util.Set<java.lang.String> getNonCatalogItemUniqueAttributes(ComposedType composedType)
protected boolean isUntranslatablePartOfItem(AttributeCopyCreator acc, Item original)
protected boolean isUntranslatableProductFeature(ProductFeature productFeature)
protected final boolean isCopyOnDemand(AttributeDescriptor attributeDescriptor)
isCopyOnDemand in class AbstractItemCopyContextprotected boolean computeIsCopyOnDemand(AttributeDescriptor attributeDescriptor)
protected boolean isCopyOnDemandCatalogItemType(ComposedType catalogItemType, java.lang.Class jaloClass)
protected final java.util.Set<ComposedType> getContainedCatalogItemTypes(AttributeDescriptor attributeDescriptor)
protected final java.util.Map<PK,de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry> getCopiedItemCache(boolean create)
protected de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry getCopy(Item source)
protected de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry queryCopy(Item source)
protected de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry queryCatalogItemCopy(Item sourceItem)
protected de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry queryNonCatalogItemCopy(Item source)
protected de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry processQueryResult(Item sourceItem, java.util.List<Item> rows, java.util.List<java.lang.Object> keys)
protected void setSavePrevousValues(boolean setSaveToOn)
public boolean isSavePrevousValues()
protected java.util.Set<AttributeDescriptor> getCreationAttributes()
GeneratedCatalogConstants.Attributes.Product.CATALOGVERSIONCatalogConstants.Attributes.Category.CATALOGVERSIONGeneratedCatalogConstants.Attributes.Media.CATALOGVERSIONGeneratedKeyword.CATALOGVERSIONGeneratedCatalogConstants.Attributes.Product.VARIANTTYPEGeneratedVariantProduct.BASEPRODUCTGeneratedProduct.UNITprotected final java.lang.String translateAD(AttributeDescriptor attributeDescriptor)
protected final void addCreationAttribute(AttributeDescriptor attributeDescriptor)
public final boolean isStarted()
protected AttributeCopyCreator createAttributeCopyCreator(ItemCopyCreator icc, AttributeCopyDescriptor acd, boolean ispreset, java.lang.Object sourceValue)
protected java.util.Set<Item> collectPartOfItemsToCopy(AttributeCopyCreator acc)
protected java.util.Map<Item,Item> copyPartOfValues(AttributeCopyCreator acc)
AttributeCopyCreator.getPartOfItemsToCopy(). The returned map contains each
partOf item and (if successfully copied) the associated copy. Please note that some attribute value items may
been untranslatable - they don't turn up in the result map!acc - the attribute copy creatorprotected final java.lang.Object translateValue(AttributeCopyCreator acc, java.lang.Object original, java.util.Map<Item,Item> partOfItemsToBeCopied, boolean localized)
protected Item translateItemValue(AttributeCopyCreator acc, Item original, java.util.Map<Item,Item> partOfItemsToBeCopied)
protected final CatalogItemCopyCreator getCurrentlyCopying(Item original)
protected final boolean isCurrentlyCopying(Item original)
protected final void pushCurrentlyCopying(CatalogItemCopyCreator icc)
protected final void popCurrentlyCopying(CatalogItemCopyCreator icc)
protected final void registerCopy(de.hybris.platform.catalog.jalo.synchronization.GenericCatalogCopyContext.ItemCopyCacheEntry copyInfo)
protected void beforeCopying(CatalogItemCopyCreator icc)
protected void afterCopying(Item copy, CatalogItemCopyCreator icc)
protected void logSavedValues(ItemCopyCreator icc)
public Item copy(Item original, Item existingCopy, ItemSyncTimestamp itemSyncTimestamp)
protected Item copy(ItemCopyCreator parent, Item original)
protected Item copy(ItemCopyCreator parent, Item original, Item copyToUpdate, ItemSyncTimestamp itemSyncTimestamp)
protected java.util.Set getCopyCreatorBlacklist(Item original, Item toUpdate)
protected java.util.Set getCopyCreatorWhitelist(Item original, Item toUpdate)
public boolean forceCopy(AttributeDescriptor attributeDescriptor)
protected boolean isRequiredForCreation(AttributeDescriptor attributeDescriptor)
AbstractItemCopyContextIf no item is actually created but an existing copy is updated these attributes are set alltogether before all partOf references and other attributes. Delaying is neither allowed here.
isRequiredForCreation in class AbstractItemCopyContextattributeDescriptor - the attribute descriptor to determine creation status forpublic void cleanup()
cleanup in class AbstractItemCopyContextprotected boolean isForceUpdate()
public int getCopyCacheSize()
public void setCopyCacheSize(int copyCacheSize)
copyCacheSize - the copyCacheSize to setprotected java.util.Set<Language> getTargetLanguages()
protected void afterCreate(ItemCopyCreator icc, Item ret)
ItemCopyCreator.copy(GenericCatalogCopyContext) right after a new item has been created but
before it's partOf items or references have been processed!icc - ret - public long getCopyCacheHits()
public void setCopyCacheHits(long copyCacheHits)
copyCacheHits - the copyCacheHits to setpublic long getCopyCacheMisses()
public void setCopyCacheMisses(long copyCacheMisses)
copyCacheMisses - the copyCacheMisses to setprotected CatalogVersion getTargetVersionForQueryCatalogItemCopy(Item sourceItem)
protected boolean canBeTranslatedPartially(AttributeCopyCreator attributeCopyCreator)
protected boolean isPartialCollectionTranslationEnabledGlobally()
Copyright © 2018 SAP SE. All Rights Reserved.