Kernel::System::Configuration::Registry

NAME

Kernel::System::Configuration::Registry

DESCRIPTION

Global ID manager for entity records.

NAME

Kernel::System::Configuration::Registry

DESCRIPTION

Configuration GIDs registry database interface module.

List()

Get a list of registered gids.

    my $Entries = $Registry->List(
        Filters => {
            Entity  => '...' # optional
            Deleted => '...' # optional
            GID     => '...' # optional
        },
    );

Returns

    C<undef> - in case any error occurs
    []       - in case no data was found
    [
        {
            ID      => '...',
            Entity  => '...',
            GID     => '...',
            LocalID => '...',
            Deleted => '...',
        },
        ...
    ]

Get()

Get a registry entry.

    my $Entry = $Registry->Get(
        GID    => '...', # required
    );

Returns

    C<undef> - in case any error occurs
    {}       - in case no data was found
    {
        ID       => '...',
        SystemID => '...',
        Entity   => '...',
        GID      => '...',
        LocalID  => '...',
        Deleted  => '...',
    }

Add()

Adds a new entry to the registry.

    my $Result = $Registry->Add(
        SystemID => '...',
        Entity   => '...',
        GID      => '...',
        LocalID  => '...',
        Deleted  => '...',
    );

Returns

    Entry ID - in case of success.
    C<undef> - in case any error occurs.

Update()

Updates registry entries.

    my $Result = $Registry->Update(
        Data => {
            Deleted => 1,
        },
        Filters => {
            Entity => '...',
            GID    => '...',
        },
    );

Returns

    1 - in case of success.
    C<undef> - in case any error occurs.

Delete()

Delete entries from the registry.

    # delete all entries.
    my $Result = $Registry->Delete();

    # delete all entries according to the filters passed.
    my $Result = $AccessTokenObject->Delete(
        Filters => {
            Entity => '...',
        },
    );

Returns

    1 - in case of success.
    C<undef> - in case any error occurs.

PRIVATE INTERFACE

_GetDBColumnMapForParams()

Get the mapping of params to database columns.

    # mapping for all params
    my $Map = $Self->_GetDBColumnMapForParams();

    # mapping only for the needed params
    my $Map = $Self->_GetDBColumnMapForParams(
        Want => [qw( Entity GID )],
    );

Returns

    a map/dictionary with the param and respective column name.

_FiltersSQLAndBinds()

Builds the SQL 'WHERE' clause and value binds based on the filters.

    # something like:
    my ($SQLWhere, $Binds) = $Self->_FiltersSQLAndBinds(
        Filters => {
            ObjectID => 999,
            Date     => '2018-02-18',
        },
    );
    # generates:
    $SQLWhere = (object_id = ?) AND (value_date = ?)
    $Binds    = [999, '2018-02-18']

    # it's possible to indicate which operator to use:
    my ($SQLWhere, $Binds) = $Self->_FiltersSQLAndBinds(
        Filters => {
            Date => { '>=' => '2018-02-18'},
        },
    );
    # generates:
    $SQLWhere = (value_date >= ?)
    $Binds    = ['2018-02-18']

Returns

    (string, arrayref)
Scroll to Top