ITSMConfigurationManagement -> rel-3_3 API documentation

NAME

Kernel::System::ITSMConfigItem::XML - sub module of Kernel::System::ITSMConfigItem

SYNOPSIS

All xml functions.

PUBLIC INTERFACE

  • XMLValueLookup()

    lookup a xml value

    my $Value = $ConfigItemObject->XMLValueLookup(
        Item  => $ItemRef,
        Value => 5,
    );
    
  • XMLStatsAttributeCreate()

    create a attribute array for the stats framework

    my $Value = $ConfigItemObject->XMLStatsAttributeCreate(
        Item => $ItemRef,
    );
    
  • XMLExportSearchValuePrepare()

    prepare xml search data for export

    my $ArrayRef = $ConfigItemObject->XMLExportSearchValuePrepare(
        Item  => $ItemRef,
        Value => 5,
    );
    
  • XMLExportValuePrepare()

    prepare xml data for export

    my $Value = $ConfigItemObject->XMLExportValuePrepare(
        Item  => $ItemRef,
        Value => 5,
    );
    
  • XMLImportSearchValuePrepare()

    prepare xml search data for import

    my $ArrayRef = $ConfigItemObject->XMLImportSearchValuePrepare(
        Item  => $ItemRef,
        Value => 5,
    );
    
  • XMLImportValuePrepare()

    prepare xml data for import

    my $Value = $ConfigItemObject->XMLImportValuePrepare(
        Item  => $ItemRef,
        Value => 5,
    );
    
  • _XMLVersionSearch()

    Search xml data of a version and return a hash reference. The What parameter is a bit like the parameter used in SQL::Abstract. The returned hash reference has VersionIDs as keys and 1 as value.

    my $VersionIDs = $ConfigItemObject->_XMLVersionSearch(
        ClassIDs => [1, 2, 3],  # (optional)
    
        What => [
            # each array element is a and condition
            {
                # or condition in hash
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => '%contentA%',
                "[%]{'Version'}[%]{'ConfigItemAttrC'}[%]{'Content'}" => '%contentA%',
            },
            {
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => '%contentB%',
                "[%]{'Version'}[%]{'ConfigItemAttrC'}[%]{'Content'}" => '%contentB%',
            },
            {
                # use array reference if different content with same key was searched
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => [
                    '%contentC%',
                    '%contentD%',
                    '%contentE%',
                ],
                "[%]{'Version'}[%]{'ConfigItemAttrC'}[%]{'Content'}" => [
                    '%contentC%',
                    '%contentD%',
                    '%contentE%',
                ],
            },
            {
                # use hash reference for specifying comparison ops, apart from the default 'LIKE'
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => { '<'        => 'alphabetically_lower_or_equal' },
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => { '<='       => 'alphabetically_less_or_equal' },
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => { '='        => 'exact_match' },
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => { '>='       => 'alphabetically_larger_or_equal' },
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => { '>'        => 'alphabetically_larger' },
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => { '-between' => [ 'lower_bound', 'upper_bound' ] },
            },
        ],
    
        PreviousVersionSearch => 1,  # (optional) default 0 (0|1)
    );
    
  • _XMLVersionGet()

    get the xml data of a version

    my $ArrayRef = $ConfigItemObject->_XMLVersionGet(
        ClassID   => 1,
        VersionID => 123,
    );
    
  • _XMLVersionAdd()

    add the xml data of a new version and move old xml versions in archiv class

    my $XMLID = $ConfigItemObject->_XMLVersionAdd(
        ClassID      => 1,
        ConfigItemID => 222,
        VersionID    => 123,
        XMLData      => $ArrayRef,
    );
    
  • _XMLVersionDelete()

    delete the xml data of a version

    my $True = $ConfigItemObject->_XMLVersionDelete(
        VersionID => 123,
        UserID    => 1,
    );
    
  • _LoadXMLTypeBackend()

    load a xml item module

    $BackendObject = $ConfigItemObject->_LoadXMLTypeBackend(
        Type => 'GeneralCatalog',
    );
    
  • _XMLHashSearch()

    Search a xml hash from database. This method is based on Kernel::System::XMLHashSearch, but has support for some extra features. A specific operator can be specified in a hash. The syntax is based on SQL::Abstract.

    my @Keys = $ConfigItemObject->_XMLHashSearch(
        Type => 'SomeType',
        What => [
            # each array element is a and condition
            {
                # or condition in hash
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => '%contentA%',
                "[%]{'Version'}[%]{'ConfigItemAttrC'}[%]{'Content'}" => '%contentA%',
            },
            {
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => '%contentB%',
                "[%]{'Version'}[%]{'ConfigItemAttrC'}[%]{'Content'}" => '%contentB%',
            },
            {
                # use array reference if different content with same key was searched
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => ['%contentC%', '%contentD%', '%contentE%'],
                "[%]{'Version'}[%]{'ConfigItemAttrC'}[%]{'Content'}" => ['%contentC%', '%contentD%', '%contentE%'],
            },
            {
                # use hash reference for specifying comparison ops, apart from the default 'LIKE'
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => { '<'         => 'alphabetically_lower_or_equal' },
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => { '<='        => 'alphabetically_less_or_equal' },
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => { '='         => 'exact_match' },
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => { '!='        => 'exact_match' },
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => { '>='        => 'alphabetically_larger_or_equal' },
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => { '>'         => 'alphabetically_larger' },
                "[%]{'Version'}[%]{'ConfigItemAttrB'}[%]{'Content'}" => { '-between'  => [ 'lower_bound', 'upper_bound' ] },
            },
        ],
    );
    

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.