Kernel::GenericInterface::Mapping::Simple

NAME

Kernel::GenericInterface::Mapping::Simple – GenericInterface simple data mapping backend

PUBLIC INTERFACE

has DebuggerObject

Attribute that holds the debugger object.

has MappingConfig

Attribute that holds the mapping config.

new()

usually, you want to create an instance of this by using Kernel::GenericInterface::Mapping->new();

Map()

provides 1:1 and regex mapping for keys and values also the use of a default for keys and values that were not mapped is possible

we need the config to be in the following format

    # {
    #     KeyMapExact => {           # optional. key/value pairs for direct replacement
    #         'old_value'         => 'new_value',
    #         'another_old_value' => 'another_new_value',
    #         'maps_to_same_value => 'another_new_value',
    #     },
    #     KeyMapRegEx => {           # optional. replace keys with value if current key matches regex
    #         'Stat(e|us)'  => 'state',
    #         '[pP]riority' => 'prio',
    #     },
    #     KeyMapDefault => {         # required. replace keys if the have not been replaced before
    #         MapType => 'Keep',     # possible values are
    #                                # 'Keep' (leave unchanged)
    #                                # 'Ignore' (drop key/value pair)
    #                                # 'MapTo' (use provided value as default)
    #         MapTo => 'new_value',  # only used if 'MapType' is 'MapTo'. then required
    #     },
    #     ValueMap => {              # optional.
    #         'new_key_name' => {    # optional. Replacement for a specific key
    #             ValueMapExact => { # optional. key/value pairs for direct replacement
    #                 'old_value'         => 'new_value',
    #                 'another_old_value' => 'another_new_value',
    #                 'maps_to_same_value => 'another_new_value',
    #             },
    #             ValueMapRegEx => { # optional. replace keys with value if current key matches regex
    #                 'Stat(e|us)'  => 'state',
    #                 '[pP]riority' => 'prio',
    #             },
    #         },
    #     },
    #     ValueMapDefault => {       # required. replace keys if the have not been replaced before
    #         MapType => 'Keep',     # possible values are
    #                                # 'Keep' (leave unchanged)
    #                                # 'Ignore' (drop key/value pair)
    #                                # 'MapTo' (use provided value as default)
    #         MapTo => 'new_value',  # only used if 'MapType' is 'MapTo'. then required
    #     },
    # }

    my $ReturnData = $MappingObject->Map(
        Data => {
            'original_key' => 'original_value',
            'another_key'  => 'next_value',
        },
    );

    my $ReturnData = {
        'changed_key'          => 'changed_value',
        'original_key'         => 'another_changed_value',
        'another_original_key' => 'default_value',
        'default_key'          => 'changed_value',
    };
Scroll to Top