Class AbstractItemCopyContext

java.lang.Object
de.hybris.platform.catalog.jalo.synchronization.AbstractItemCopyContext
Direct Known Subclasses:
GenericCatalogCopyContext

public abstract class AbstractItemCopyContext extends Object
Since:
3.1-u6
  • Field Details

  • Constructor Details

    • AbstractItemCopyContext

      protected AbstractItemCopyContext(SessionContext ctx, org.apache.log4j.Level logLevel)
  • Method Details

    • createSession

      protected JaloSession createSession()
      Returns:
      current JaloSession
    • log

      protected void log(String message, org.apache.log4j.Level level, Throwable e)
    • log

      protected void log(String message, org.apache.log4j.Level level)
      Default log implementation using a Log4J appender.
    • debug

      public void debug(String message, Throwable e)
    • info

      public void info(String message, Throwable e)
    • warn

      public void warn(String message, Throwable e)
    • error

      public void error(String message, Throwable e)
    • debug

      public void debug(String message)
    • info

      public void info(String message)
    • warn

      public void warn(String message)
    • error

      public void error(String message)
    • isDebugEnabled

      public boolean isDebugEnabled()
    • isInfoEnabled

      public boolean isInfoEnabled()
    • isWarnEnabled

      public boolean isWarnEnabled()
    • isErrorEnabled

      public boolean isErrorEnabled()
    • getCtx

      public final SessionContext getCtx()
    • getSession

      protected final JaloSession getSession()
      Returns:
      JaloSession which is bound to this CopyContext
    • allItems

      protected Collection<Item> allItems(AttributeCopyCreator acc, Object value)
      Returns (recursively) all items which were found in the given value. If the value is
      • an Item: this item is returned
      • a Collection: the containing Items are returned
      • a Map for a localized attribute: the map values (which are items) are returned
      • a Map for a non-localized attribute: the map keys and values (which are items) are returned
      Returns:
      an empty set if nothing (no item) was found at all.
    • getTypeCopyDescriptor

      public TypeCopyDescriptor getTypeCopyDescriptor(ComposedType type)
      Returns a (cached) type copy descriptor for a given composed type.
    • createCopyDescriptor

      protected TypeCopyDescriptor createCopyDescriptor(ComposedType composedType)
      Creates a new type copy descriptor instance. By default this will create a TypeCopyDescriptor. Called by getTypeCopyDescriptor(ComposedType).
      Parameters:
      composedType -
    • splitDescriptors

      protected Set<AttributeCopyDescriptor>[] splitDescriptors(TypeCopyDescriptor tcd, ComposedType composedType)
      Called during the creation of a TypeCopyDescriptor. It must split all attribute descriptors into 4 different sets:
      • initial writable only
      • initial
      • partOf attributes
      • other (mostly reference) attributes
      Parameters:
      tcd - the newly created type copy descriptor
      composedType - the actual composed type
      Returns:
      an array of 4 sets holding AttributeCopyDescriptors.
    • isAtomic

      protected boolean isAtomic(AttributeDescriptor attributeDescriptor)
      Used by splitDescriptors(TypeCopyDescriptor, ComposedType)to determine whether an attribute holds just atomic values. This will call isAtomic(Type, boolean)for analyzing the real attribute type.
    • isAtomic

      protected boolean isAtomic(Type attributeType, boolean localized)
      Traverses collection and map types to find any non-atomic type within. If localized is true and the attribute type is a map type it ignores the argument type - however nested map types are fully searched subsequently.
      Parameters:
      attributeType - the argument type to check
      localized - whether or not the attribute is localized
      Returns:
      true if the argument type is a atomic type or a collection or map type containing atomic types only
    • isPartOf

      protected boolean isPartOf(AttributeDescriptor attributeDescriptor)
      Used by splitDescriptors(TypeCopyDescriptor, ComposedType)to determine whether an attribute holds partOf values. These values are always copied (created or translated if already existing) when the original item is being copied.
    • isCopyOnDemand

      protected boolean isCopyOnDemand(AttributeDescriptor attributeDescriptor)
    • isRequiredForCreation

      protected boolean isRequiredForCreation(AttributeDescriptor attributeDescriptor)
      Determines whether or not a attribute is required for the creation of a item copy. These attributes cannot be delayed, which requires that all values must be translatable or preset.

      If 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.

      Parameters:
      attributeDescriptor - the attribute descriptor to determine creation status for
      Returns:
      true if the attribute is required for item creation
    • ignoreAttribute

      protected boolean ignoreAttribute(AttributeDescriptor attributeDescriptor, String qualifier)
      Used by splitDescriptors(TypeCopyDescriptor, ComposedType)to determine whether an attribute may be ignored or not. By default this will apply to Item.TYPEonly. Override to define own ignored attributes.
      Parameters:
      attributeDescriptor -
      qualifier -
      Returns:
      true if the attribute should not be included in type copy informations (so it cannot be copied)
    • toString

      protected String toString(AttributeDescriptor attributeDescriptor)
    • safeToString

      protected String safeToString(Object attributeValue)
    • valuesToString

      protected String valuesToString(Map attributeValues)
    • cleanup

      public void cleanup()
    • getCatalogManager

      protected CatalogManager getCatalogManager()
    • getFlexibleSearch

      protected FlexibleSearch getFlexibleSearch()
    • toItem

      protected Item toItem(PK pk)
      Returns for the given PK the Item
      Returns:
      null if not found or not valid anymore.
    • toItems

      protected Collection<? extends Item> toItems(Collection<PK> pks)