Kernel::GenericInterface::Operation::ConfigItem::ConfigItemSearch

NAME

Kernel::GenericInterface::Operation::ConfigItem::ConfigItemSearch – GenericInterface ConfigItem ConfigItemSearch Operation backend

PUBLIC INTERFACE

around _BuildConfig()

Overwrites the builder method _BuildConfig (has Config), to set a default value.

OperationName()

Returns the name of the operation.

Run()

perform ConfigItemSearch Operation. This will return a configuration item ID list.

    my $Result = $OperationObject->Run(
        Data => {
            UserLogin         => 'some agent login',                        # UserLogin or AccessToken is
            AccessToken       => 'eyJhbGciOiJIUzI1NiJ9[...]',               # required


            Password  => 'some password',                                   # if UserLogin is sent then
                                                                            #   Password is required
            ConfigItem => {
                Class        => 'The ConfigItem Class',
                Number       => 'The ConfigItem Number',                    # (optional)
                Name         => 'The ConfigItem Name',                      # (optional)
                DeplStates   => ['deployment state'],                       # (optional)
                InciStates   => ['incident state'],                         # (optional)

                # config items with created time after ...
                ConfigItemCreateTimeNewerDate => '2006-01-09 00:00:01',     # (optional)

                # config items with created time before then ....
                ConfigItemCreateTimeOlderDate => '2006-01-19 23:59:59',     # (optional)

                # config items with changed time after ...
                ConfigItemChangeTimeNewerDate => '2006-01-09 00:00:01',     # (optional)

                # config items with changed time before then ....
                ConfigItemChangeTimeOlderDate => '2006-01-19 23:59:59',     # (optional)

                CIXMLData    => $ArrayHashRef,                              # (optional), it depends on the Configuration
                                                                            #   Item class and definition

                PreviousVersionSearch => 1,  # (optional) default 0 (0|1)

                OrderBy => [ 'ConfigItemID', 'Number' ],                    # (optional)
                # default: [ 'ConfigItemID' ]
                # (ConfigItemID, Number, ClassID, DeplStateID, InciStateID,
                # CreateTime, CreateBy, ChangeTime, ChangeBy)

                # Additional information for OrderBy:
                # The OrderByDirection can be specified for each OrderBy attribute.
                # The pairing is made by the array indices.

                OrderByDirection => [ 'Down', 'Up' ],                       # (optional)
                # default: [ 'Down' ]
                # (Down | Up)

                Limit          => 122,                                      # (optional)
            },
        },
    );

    $Result = {
        Success         => 1,                       # 0 or 1
        ErrorMessage    => '',                      # in case of error
        Data            => {                        # result data payload after Operation
            ConfigItemID     => [123, 456],         # Configuration Item  IDs number in OTRS::ITSM (Service desk system)
            Error => {                              # should not return errors
                    ErrorCode    => 'ConfigItemSearch.ErrorCode'
                    ErrorMessage => 'Error Description'
            },
        },
    };

INTERNAL INTERFACE

_CleanXMLData()

removed trailing and leading white spaces in the XMLData.

    my $XMLDataClean = $OperationObject->_CleanXMLData(
        Definition => $DefinitionArrayRef,          # Configuration Item Definition ot just part of it
        XMLData    => $XMLDataHashRef,
    );

    returns:

    $XMLDataClean = {
        Success => 1,                               # if everything is OK
    }

    $XMLDataClean = {
        ErrorCode    => 'Function.Error',           # if error
        ErrorMessage => 'Error description',
    }

_CheckConfigItem()

checks if the given config item parameters are valid.

    my $ConfigItemCheck = $OperationObject->_CheckConfigItem(
        ConfigItem => $ConfigItem,                  # all config item parameters
    );

    returns:

    $ConfigItemCheck = {
        Success => 1,                               # if everything is OK
    }

    $ConfigItemCheck = {
        ErrorCode    => 'Function.Error',           # if error
        ErrorMessage => 'Error description',
    }

_ConfigItemSearch()

search a configuration items.

    my $Response = $OperationObject->_ConfigItemSearch(
        ConfigItem     => $ConfigItem,             # all configuration item parameters
        UserID         => 123,
    );

    returns:

    $Response = {
        Success => 1,                               # if everething is OK
        Data => {
            ConfigItemIDs => [123, 456],
        }
    }

    $Response = {
        Success      => 0,                         # if unexpected error
        ErrorMessage => "$Param{ErrorCode}: $Param{ErrorMessage}",
    }

_CheckSearchXMLData()

checks if the given XMLData value are valid.

    my $XMLDataCheck = $CommonObject->_CheckSearchXMLData(
        Definition => $DefinitionArrayRef,          # Configuration Item Definition ot just part of it
        XMLData    => $XMLDataHashRef,
        Parent     => 'some parent',
    );

    returns:

    $XMLDataCheck = {
        Success => 1,                               # if everything is OK
    }

    $XMLDataCheck = {
        ErrorCode    => 'Function.Error',           # if error
        ErrorMessage => 'Error description',
    }

_CheckValue()

checks if the given value is valid.

    my $ValueCheck = $CommonObject->_CheckValue(
        Value   => $Value                           # $Value could be a string, a time stamp,
                                                    #   general catalog class name, or a integer
        Input   => $InputDefinitionHashRef,         # The definition of the element input extracted
                                                    #   from the Configuration Item definition for
                                                    #   for each value
        ItemKey => 'some key',                      # The name of the value as sent in the SOAP
                                                    #   request
        Parent  => 'soem parent key->',             # The name of the parent followed by -> or empty
                                                    #   for root key items
    );

    returns:

    $ValueCheck = {
        Success => 1,                            # if everything is OK
    }

    $ValueCheck = {
        ErrorCode    => 'Function.Error',        # if error
        ErrorMessage => 'Error description',
    }

_FormatSearchXMLData()

Create a XMLData suitable for ConfigItemSeach.

    my $NewXMLData = $OperationObject->_FormatSearchXMLData(
        XMLData    => $XMLDataHashRef,
        Child      => 1,                    # or 0, optional
    );

    returns:

    $NewXMLData = $XMLDataHashRef,                  # suitable for version add
Scroll to Top