Kernel::GenericInterface::Operation::ConfigItem::Common

NAME

Kernel::GenericInterface::Operation::ConfigItem::Common – Base role for all CI Operations

PUBLIC INTERFACE

has Config

Contains the operation config hash.

has ClassList

Contains the configuration item class list of the general catalog.

has ReverseClassList

Contains the reverse configuration item class list of the general catalog.

has InciStateList

Contains the incident state list of the general catalog.

has ReverseInciStateList

Contains the reverse incident state list of the general catalog.

has DeplStateList

Contains the deployment state list of the general catalog.

has ReverseDeplStateList

Contains the reverse deployment state list of the general catalog.

OperationName()

Returns the name of the current operation. This method has to be overwritten by the related operation module.

Init()

initialize the operation by checking the web-service configuration

    my $Return = $CommonObject->Init(
        WebserviceID => 1,
    );

    $Return = {
        Success => 1,                       # or 0 in case of failure,
        ErrorMessage => 'Error Message',
    }

ValidateClass()

checks if the given Class is valid.

    my $Sucess = $CommonObject->ValidateClass(
        Class => 'some class',
    );

    returns
    $Success = 1            # or 0

ValidateDeplState()

checks if the given DeplState is valid.

    my $Sucess = $CommonObject->ValidateDeplState(
        DelpState => 'some DeplState',
    );

    returns
    $Success = 1            # or 0

ValidateInciState()

checks if the given InciState is valid.

    my $Sucess = $CommonObject->ValidateInciState(
        InciState => 'some InciState',
    );

    returns
    $Success = 1            # or 0

ValidateInputText()

checks if the given value is valid.

    my $Sucess = $CommonObject->ValidateInputText(
        Value     => 'some value',
        MaxLength => 123,
    );

    returns
    $Success = 1            # or 0

ValidateInputDate()

checks if the given value is valid.

    my $Sucess = $CommonObject->ValidateInputDate(
        Value => '12/12/1977',
    );

    or

    my $Sucess = $CommonObject->ValidateInputDate(
        Value => '1977-12-12',
    );

    returns
    $Success = 1            # or 0

ValidateInputDateTime()

checks if the given value is valid.

    my $Sucess = $CommonObject->ValidateInputDateTime(
        Value => '12/12/1977 12:00:00',
    );

    or

    my $Sucess = $CommonObject->ValidateInputDateTime(
        Value => '1977-12-12 12:00:00',
    );

    returns
    $Success = 1            # or 0

ValidateInputInteger()

checks if the given value is valid.

    my $Sucess = $CommonObject->ValidateInputInteger(
        Value => 123,
    );

    returns
    $Success = 1            # or 0

ValidateInputGeneralCatalog()

checks if the given value is valid.

    my $Sucess = $CommonObject->ValidateInputGeneralCatalog(
        Value => 123,
        Class => 'Some general catalog class'
    );

    returns
    $Success = 1            # or 0

ValidateInputCustomer()

checks if the given value is valid.

    my $Sucess = $CommonObject->ValidateInputCustomer(
        Value => 'some customer login',
    );

    returns
    $Success = 1            # or 0

ValidateInputCustomerCompany()

checks if the given value is valid.

    my $Sucess = $CommonObject->ValidateInputCustomerCompany(
        Value => 'some customer company name',
    );

    returns
    $Success = 1            # or 0

ReplaceInputDate()

replaces the user value with a system valid value.

    my $NewValue = $CommonObject->ReplaceInputDate(
        Value => '12/12/1977',
    );

    or

    my $NewValue = $CommonObject->ReplaceInputDate(
        Value => '1977-12-12',
    );

    returns
    $NewValue = '1977-12-12',

ReplaceInputDateTime()

replaces the user value with a system valid value.

    my $NewValue = $CommonObject->ReplaceInputDateTime(
        Value => '12/12/1977 12:00:00',
    );

    or

    my $NewValue = $CommonObject->ReplaceInputDateTime(
        Value => '1977-12-12 12:00:00',
    );

    returns
    $NewValue = '1977-12-12 12:00:00';

ReplaceInputGeneralCatalog()

replaces the user value with a system valid value.

    my $NewValue = $CommonObject->ReplaceInputGeneralCatalog(
        Value => 'some value',
        Class => 'Some general catalog class'
    );

    returns
    $NewValue = 123

InvertReplaceInputDate()

replaces the system value with a user value.

    my $NewValue = $CommonObject->InvertReplaceInputDate(
        Value => '12-12-1977 00:00:00',
    );

    returns
    $NewValue = '1977-12-12',

InvertReplaceInputGeneralCatalog()

replaces the system value with a user value.

    my $NewValue = $CommonObject->InvertReplaceInputGeneralCatalog(
        Value => 123,
        Class => 'Some general catalog class'
    );

    returns
    $NewValue = 'some value'

CreateAttachment()

creates a new attachment for the given ConfigItem.

    my $Result = $CommonObject->CreateAttachment(
        Content      => $Data,                   # file content (Base64 encoded)
        ContentType  => 'some content type',
        Filename     => 'some filename',
        ConfigItemID => 456,
        UserID       => 123,
    );

    returns
    $Result = {
        Success => 1,                        # if everything is ok
    }

    $Result = {
        Success      => 0,
        ErrorMessage => 'Error description'
    }

CheckXMLData()

checks if the given XMLData value are valid.

    my $XMLDataCheck = $CommonObject->CheckXMLData(
        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',
    }

ReplaceXMLData()

replace the XMLData to one that uses internal values.

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

    returns:

    $NewXMLData = $XMLDataHashRef,                  # with replaced values

FormatXMLData()

Create a XMLData suitable for VersionAdd.

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

    returns:

    $NewXMLData = $XMLDataHashRef,                  # suitable for version add

InvertFormatXMLData()

Creates a readable XMLData.

    my $NewXMLData = $CommonObject->InvertFormatXMLData(
        XMLData    => $XMLDataHashRef,
    );

    returns:

    $NewXMLData = $XMLDataHashRef,                  # suitable for version add

InvertReplaceXMLData()

replace the XMLData to one that uses user values.

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

    returns:

    $NewXMLData = $XMLDataHashRef,                  # with replaced values

INTERNAL INTERFACE

_BuildConfig()

Attribute builder method to return the operation config for the related operation module.

_BuildClassList()

Attribute builder method to return the config item class list.

_BuildReverseClassList()

Attribute builder method to return the reverse config item class list.

_BuildInciStateList()

Attribute builder method to return the config item incident state list.

_BuildReverseInciStateList()

Attribute builder method to return the reverse config item incident state list.

_BuildDeplStateList()

Attribute builder method to return the config item deployment state list.

_BuildReverseDeplStateList()

Attribute builder method to return the reverse config item deployment state list.

_CharsetList()

returns a list of all available charsets.

    my $CharsetList = $CommonObject->_CharsetList(
        UserID => 123,
    );

    returns
    $Success = {
        #...
        iso-8859-1  => 1,
        iso-8859-15 => 1,
        MacRoman    => 1,
        utf8        => 1,
        #...
    }

_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',
    }

_ReplaceValue()

replace user values with system ready values.

    my $NewValue = $CommonObject->_ReplaceValue(
        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
                                                    #   for root key items
    );

    returns:

    $NewValue = $ANewValue

_InvertReplaceValue()

replace internal values with user values.

    my $NewValue = $OperationObject->_InvertReplaceValue(
        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
                                                    #   for root key items
    );

    returns:

    $NewValue = $ANewValue
Scroll to Top