
################
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:


.. code-block:: perl

     # 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.


.. code-block:: perl

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


Returns:


.. code-block:: perl

     1 in case of success, 0 in case of errors



CommunicationIDGet()
====================


Returns the communication id.


.. code-block:: perl

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


Returns:


.. code-block:: perl

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



TransportGet()
==============


Returns the used transport.


.. code-block:: perl

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


Returns:


.. code-block:: perl

     The transport of the current communication represented by this object.



DirectionGet()
==============


Returns the used direction.


.. code-block:: perl

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


Returns:


.. code-block:: perl

     The direction of the current communication represented by this object.



StatusGet()
===========


Returns the current Status.


.. code-block:: perl

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


Returns:


.. code-block:: perl

     The status of the current communication represented by this object.



ObjectLogStart()
================


Starts a log object of a given object type.


.. code-block:: perl

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


Returns:


.. code-block:: perl

     1 in case of success, 0 in case of errors



ObjectLogStop()
===============


Stops a log object of a given object type.


.. code-block:: perl

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


Returns:


.. code-block:: perl

     1 in case of success, 0 in case of errors



ObjectLog()
===========


Adds a log entry for a certain log object.


.. code-block:: perl

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


Returns:


.. code-block:: perl

     1 in case of success, 0 in case of errors



ObjectLookupSet()
=================


Inserts or updates a lookup information.


.. code-block:: perl

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


Returns:


.. code-block:: perl

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



ObjectLookupGet()
=================


Gets the object lookup information.


.. code-block:: perl

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


Returns:


.. code-block:: perl

     <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.


.. code-block:: perl

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


Returns:


.. code-block:: perl

     The ObjectLogID or undef.



PRIVATE INTERFACE
=================


Private methods


_CommunicationStart()
=====================


Create a new communication entry.


.. code-block:: perl

     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:


.. code-block:: perl

     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.




