CommunicationLog#

PUBLIC INTERFACE#

new()#

Creates a CommunicationLog object. Do not use new() directly, instead use the object manager. This is a class which represents a complete communication. Therefore the created instances must not be shared between processes of different communications.

Please use the object manager as follows for this class:

# Create an object, representing a new communication:
my $CommunicationLogObject = $Kernel::OM->Create(
    'Kernel::System::CommunicationLog',
    ObjectParams => {
        Transport => 'Email',
        Direction => 'Incoming',
    }
);

# Create an object for an already existing communication:
my $CommunicationLogObject = $Kernel::OM->Create(
    'Kernel::System::CommunicationLog',
    ObjectParams => {
        CommunicationID => 123,
    }
);

CommunicationStop()#

Update the status of a communication entry.

my $Success = $CommunicationLogObject->CommunicationStop(
    Status => 'Successful', # (required) Needs to be either 'Successful', 'Warning' or 'Failed'
);

Returns:

1 in case of success, 0 in case of errors

CommunicationIDGet()#

Returns the communication id.

my $CommunicationID = $CommunicationLogObject->CommunicationIDGet();

Returns:

The communication id of the current communication represented by this object.

TransportGet()#

Returns the used transport.

my $Transport = $CommunicationLogObject->TransportGet();

Returns:

The transport of the current communication represented by this object.

DirectionGet()#

Returns the used direction.

my $Direction = $CommunicationLogObject->DirectionGet();

Returns:

The direction of the current communication represented by this object.

StatusGet()#

Returns the current Status.

my $Direction = $CommunicationLogObject->StatusGet();

Returns:

The status of the current communication represented by this object.

ObjectLogStart()#

Starts a log object of a given object type.

my $ObjectID = $CommunicationLogObject->ObjectLogStart(
    ObjectType => 'Connection' # (required) Can be 'Connection' or 'Message'
);

Returns:

1 in case of success, 0 in case of errors

ObjectLogStop()#

Stops a log object of a given object type.

my $Success = $CommunicationLogObject->ObjectLogStop(
    ObjectLogType => 'Connection',                       # (required) Can be 'Connection' or 'Message'
    ObjectLogID   => 123, # (required) The ObjectID of the started object type
);

Returns:

1 in case of success, 0 in case of errors

ObjectLog()#

Adds a log entry for a certain log object.

my $Success = $CommunicationLogObject->ObjectLog(
    ObjectLogType => '...', # (required) To be defined by the related LogObject
    ObjectLogID   => 123,   # (required) The ObjectID of the started object type
);

Returns:

1 in case of success, 0 in case of errors

ObjectLookupSet()#

Inserts or updates a lookup information.

my $Result = $CommunicationLogObject->ObjectLookupSet(
    ObjectID         => 123,       # (required)
    TargetObjectType => 'Article', # (required)
    TargetObjectID   => 123,       # (required)
);

Returns:

<undef> - if any error occur
      1 - in case of success

ObjectLookupGet()#

Gets the object lookup information.

my $Result = $CommunicationLogObject->ObjectLookupGet(
    TargetObjectID   => '...',
    TargetObjectType => '...',
);

Returns:

<undef> - if any error occur
An hashref with object lookup information - in case info exists
An empty hasref                           - in case info doesn't exists

IsObjectLogOpen()#

Checks if a given ObjectLogType has an open Object or not.

my $Result = $CommunicationLogObject->IsObjectLogOpen(
    ObjectLogType => '...',     # Required
);

Returns:

The ObjectLogID or undef.

PRIVATE INTERFACE#

Private methods

_CommunicationStart()#

Create a new communication entry.

my $Success = $CommunicationLogObject->CommunicationStart(
    Status      => 'Processing',    # (optional) Needs to be either 'Successful', 'Processing', 'Warning' or 'Failed'
                                    # In most of the cases, just 'Processing' will make sense at the very beginning
                                    # of a communication (Default: 'Processing').
    AccountType => 'AccountType',   # (optional) The used account type
    AccountID   => 123,             # (optional) The used account id
);

Returns:

1 in case of success, 0 in case of errors

_RecoverCommunciationObject()#

Recover a Communication object given an CommunicationID or ObjectLogID.

_LogError()#

Helper Method for logging.