ITSMConfigurationManagement -> rel-3_3 API documentation

NAME

Kernel::System::ImportExport::ObjectBackend::ITSMConfigItem - import/export backend for ITSMConfigItem

SYNOPSIS

All functions to import and export ITSM config items.

  • new()

    create an object

    use Kernel::Config;
    use Kernel::System::Encode;
    use Kernel::System::DB;
    use Kernel::System::Log;
    use Kernel::System::Main;
    use Kernel::System::ImportExport::ObjectBackend::ITSMConfigItem;
    
    my $ConfigObject = Kernel::Config->new();
    my $EncodeObject = Kernel::System::Encode->new(
        ConfigObject => $ConfigObject,
    );
    my $LogObject = Kernel::System::Log->new(
        ConfigObject => $ConfigObject,
        EncodeObject => $EncodeObject,
    );
    my $MainObject = Kernel::System::Main->new(
        ConfigObject => $ConfigObject,
        EncodeObject => $EncodeObject,
        LogObject    => $LogObject,
    );
    my $DBObject = Kernel::System::DB->new(
        ConfigObject => $ConfigObject,
        EncodeObject => $EncodeObject,
        LogObject    => $LogObject,
        MainObject   => $MainObject,
    );
    my $BackendObject = Kernel::System::ImportExport::ObjectBackend::ITSMConfigItem->new(
        ConfigObject       => $ConfigObject,
        EncodeObject       => $EncodeObject,
        LogObject          => $LogObject,
        DBObject           => $DBObject,
        MainObject         => $MainObject,
        ImportExportObject => $ImportExportObject,
    );
    
  • ObjectAttributesGet()

    get the object attributes of an object as a ref to an array of hash references

    my $Attributes = $ObjectBackend->ObjectAttributesGet(
        UserID => 1,
    );
    
  • MappingObjectAttributesGet()

    get the mapping attributes of an object as array/hash reference

    my $Attributes = $ObjectBackend->MappingObjectAttributesGet(
        TemplateID => 123,
        UserID     => 1,
    );
    
  • SearchAttributesGet()

    get the search object attributes of an object as array/hash reference

    my $AttributeList = $ObjectBackend->SearchAttributesGet(
        TemplateID => 123,
        UserID     => 1,
    );
    
  • ExportDataGet()

    get export data as 2D-array-hash reference

    my $ExportData = $ObjectBackend->ExportDataGet(
        TemplateID => 123,
        UserID     => 1,
    );
    
  • ImportDataSave()

    imports a single entity of the import data. The TemplateID points to the definition of the current import. ImportDataRow holds the data. Counter is only used in error messages, for indicating which item was not imported successfully.

    The current version of the config item will never be deleted. When there are no changes in the data, the import will be skipped. When there is new or changed data, then a new config item or a new version is created.

    In the case of changed data, the new version of the config item will contain the attributes of the ImportDataRow plus the old attributes that are not part of the import definition. Thus ImportDataSave() guarantees to not overwrite undeclared attributes.

    The behavior when imported attributes are empty depends on the setting in the object data. When EmptyFieldsLeaveTheOldValues is not set, then empty values will wipe out the old data. This is the default behavior. When EmptyFieldsLeaveTheOldValues is set, then empty values will leave the old values.

    The decision what constitute an empty value is a bit hairy. Here are the rules. Fields that are not even mentioned in the Import definition are empty. These are the 'not defined' fields. Empty strings and undefined values constitute empty fields. Fields with with only one or more whitespace characters are not empty. Fields with the digit '0' are not empty.

    my ( $ConfigItemID, $RetCode ) = $ObjectBackend->ImportDataSave(
        TemplateID    => 123,
        ImportDataRow => $ArrayRef,
        Counter       => 367,
        UserID        => 1,
    );
    

    An empty ConfigItemID indicates failure. Otherwise it indicates the location of the imported data. RetCode is either 'Created', 'Updated' or 'Skipped'. 'Created' means that a new config item has been created. 'Updated' means that a new version has been added to an existing config item. 'Skipped' means that no new version has been created, as the new data is identical to the latest version of an existing config item.

    No codes have yet been defined for the failure case.

TERMS AND CONDITIONS

This software is part of the OTRS project (https://otrs.org/).

This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (GPL). If you did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.