Class AbstractItemCopyContext

  • Direct Known Subclasses:
    GenericCatalogCopyContext

    public abstract class AbstractItemCopyContext
    extends java.lang.Object
    Since:
    3.1-u6
    • Constructor Detail

      • AbstractItemCopyContext

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

      • createSession

        protected JaloSession createSession()
        Returns:
        current JaloSession
      • log

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

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

        public void debug​(java.lang.String message,
                          java.lang.Throwable e)
      • info

        public void info​(java.lang.String message,
                         java.lang.Throwable e)
      • warn

        public void warn​(java.lang.String message,
                         java.lang.Throwable e)
      • error

        public void error​(java.lang.String message,
                          java.lang.Throwable e)
      • debug

        public void debug​(java.lang.String message)
      • info

        public void info​(java.lang.String message)
      • warn

        public void warn​(java.lang.String message)
      • error

        public void error​(java.lang.String message)
      • isDebugEnabled

        public boolean isDebugEnabled()
      • isInfoEnabled

        public boolean isInfoEnabled()
      • isWarnEnabled

        public boolean isWarnEnabled()
      • isErrorEnabled

        public boolean isErrorEnabled()
      • getSession

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

        protected java.util.Collection<Item> allItems​(AttributeCopyCreator acc,
                                                      java.lang.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.
      • splitDescriptors

        protected java.util.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​(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
      • 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,
                                          java.lang.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)
      • safeToString

        protected java.lang.String safeToString​(java.lang.Object attributeValue)
      • valuesToString

        protected java.lang.String valuesToString​(java.util.Map attributeValues)
      • cleanup

        public void cleanup()
      • toItem

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

        protected java.util.Collection<? extends Item> toItems​(java.util.Collection<PK> pks)