Kernel::System::ITSMConfigItem::Definition

NAME

Kernel::System::ITSMConfigItem::Definition – sub module of Kernel::System::ITSMConfigItem

PUBLIC INTERFACE

DESCRIPTION

All definition functions.

DefinitionList()

return a configuration item definition list as array-hash reference

    my $DefinitionListRef = $ConfigItemObject->DefinitionList(
        ClassID => 123,
    );

returns

    my $DefinitionListRef = [
          {
            'Version'      => '1',
            'CreateTime'   => '2012-06-12 14:09:43',
            'DefinitionID' => '1',
            'CreateBy'     => '123',
            'Definition'   => '---
- Key: Vendor
  Name: Vendor
  Searchable: 1
  Input:
  - Type: Text
    Size: 50
    MaxLength: 50

– Key: Description Name: Description Searchable: 1 Input: – Type: TextArea

– Key: Type Name: Type Searchable: 1 Input: – Type: TextArea – Type: GeneralCatalog\ Class: ITSM::ConfigItem::Computer::Type Translation: 1 # … etc … ', }, ];

DefinitionGet()

return a configuration item definition as hash reference

Return $Definition->{DefinitionID} $Definition->{ClassID} $Definition->{Class} $Definition->{Definition} $Definition->{DefinitionRef} $Definition->{Version} $Definition->{CreateTime} $Definition->{CreateBy}

    my $DefinitionRef = $ConfigItemObject->DefinitionGet(
        DefinitionID => 123,
    );

    or

    my $DefinitionRef = $ConfigItemObject->DefinitionGet(
        ClassID => 123,
    );

DefinitionAdd()

add a new definition

    my $DefinitionID = $ConfigItemObject->DefinitionAdd(
        ClassID    => 123,
        Definition => 'the definition code',
        UserID     => 1,
    );

DefinitionCheck()

check the syntax of a new definition

    my $True = $ConfigItemObject->DefinitionCheck(
        Definition      => 'the definition code',
        CheckSubElement => 1,                 # (optional, default 0, to check sub elements recursively)
    );

DefinitionAttributeInfo()

Return attribute information from the definition for a given attribute path name

    my $AttributeInfo = $ConfigItemObject->DefinitionAttributeInfo(
        AttributePath => 'HardDisk::Capacity',
        Definition    => '
            [
                # ...

                {
                    Key => 'HardDisk',
                    Name => 'Hard Disk',
                    Input => {
                        Type => 'Text',
                        Size => 50,
                        MaxLength => 100,
                    },
                    CountMax => 10,
                    Sub => [
                        {
                            Key => 'Capacity',
                            Name => 'Capacity',
                            Input => {
                                Type => 'Text',
                                Size => 20,
                                MaxLength => 10,
                            },
                        },
                    ],
                },

                # ...
            ];
        ',
    );

    Returns:

        my $AttributeInfo =  {
            CountDefault => 1,
            CountMax     => 1,
            Input => {
                Size      => 20,
                Type      => 'Text',
                MaxLength => 10
            },
            Name     => 'Capacity',
            CountMin => 1,
            Key      => 'Capacity'
        };
Scroll to Top