The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XAO::DO::ImportMap::Base -- base class for all XAO import maps

DESCRIPTION

All ClearingPoint import maps must have this class in their inheritance hierarchy. It provides basic functionality and common API methods even if these methods cannot do anything in generic way.

Methods are:

category_hash_to_array ($)

Converts older CPoint style hash into planar category path to category path mapping to be stored into object.

Source hash has the following format:

 my %map=(
    '_keep_original'                => 'By Manufacturer::3M Products',
    '3M(TM) Clean Room Products'    => {
        '_root'                     => 'Clean Room Products',
        'General Purpose Tapes'     => '::General Purpose Tapes',
    },
    'Industrial Tapes'              => {
        '_root'                     => [ 'Industrial Tapes',
                                         'Packaging Materials'
                                       ],
        '3M(TM) Sealing and Holding Products'
                                    => '::Sealing & Holding'
    }
 );

Result will be in two array references:

 my ($src_cat,$dst_cat)=$self->category_hash_to_array(\%map);

First array will hold the list of all full source category paths and the second one - destination paths.

map_category ($$)

Translates one category path into another according to translation table stored on the object (CategoryMap). Elements of path are separated by double colon -- `::'.

If there is no exact match for the category translate_category() will strip elements from the end of path and try again. If that gave a translated path then translate_category() will check if that path has sub-paths in which case it will return 'Other' sub-path in that found path. Otherwise it will return the path itself.

First argument is a reference to the hash used unternally by map_category, just provide a reference to an empty hash to the first call and keep that reference the same throughout all the calls.

Second argument is a category path to be translated.

Always returns a list reference even if that was one to one match.

May return empty list if that category is not mapped anywhere and should be ignored.

map_xml_categories ($$)

Pure virtual method that is supposed to translate all categories from RawXML container (first argument) to Categories container (second argument).

Returns a reference to the hash that contains a map between external and internal category IDs. Pass this hash reference to the map_xml_products() method.

Should be overriden unless your catalog has no categories information whatsoever.

map_xml_products ($$$)

Pure virtual method that is supposed to translate all products from RawXML container (second argument) to Products container (third argument) using category ID translation map (fourth argument).

The first argument is currently just a text prefix that would be added to all product IDs before storing them. Later that should be changed to a SKU translating object reference or code reference.

You must override that method in derived classes.

normalize_category_path ($)

Removes double spaces, spaces in the beginning and at the end of path element.

product_id ($$)

Analyzes product and generates product SKU and suggested product ID (list ID). Supposed to be overriden in project specific implementations.

xattr

Convenience method to get attribute value out of XML::DOM item.

AUTHORS

Copyright (c) 2005 Andrew Maltsev

Copyright (c) 2001-2004 Andrew Maltsev, XAO Inc.

<am@ejelta.com> -- http://ejelta.com/xao/