
########
Activity
########


****
NAME
****


Kernel::System::ProcessManagement::DB::Activity


***********
DESCRIPTION
***********


Process Management DB Activity backend


****************
PUBLIC INTERFACE
****************


new()
=====


Don't use the constructor directly, use the ObjectManager instead:


.. code-block:: perl

     my $ActivityObject = $Kernel::OM->Get('Kernel::System::ProcessManagement::DB::Activity');



ActivityAdd()
=============


add new Activity

returns the id of the created activity if success or undef otherwise


.. code-block:: perl

     my $ID = $ActivityObject->ActivityAdd(
         EntityID => 'A1',                                               # mandatory, exportable unique identifier
         Name     => 'NameOfActivity',                                   # mandatory
         Config   => {                                                   # mandatory, activity configuration to be stored in YAML format
             Scope         => 'Global',                                  # mandatory, default 'Global' (Process|Global)
             ScopeEntityID => 'Process-9690ae9ae455d8614d570149b8ab1199' # ScopeEntityID, used if specific scope is set e.g. 'Process'
         },
         UserID   => 123,                                                # mandatory
     );


Returns:


.. code-block:: perl

     $ID = 567;



ActivityDelete()
================


delete an Activity

returns 1 if success or undef otherwise


.. code-block:: perl

     my $Success = $ActivityObject->ActivityDelete(
         ID      => 123,
         UserID  => 123,
     );



ActivityGet()
=============


get Activity attributes


.. code-block:: perl

     my $Activity = $ActivityObject->ActivityGet(
         ID                  => 123,      # ID or EntityID is needed
         EntityID            => 'A1',
         ActivityDialogNames => 1,        # default 0, 1 || 0, if 0 returns an ActivityDialogs array
                                          #     with the activity dialog entity IDs, if 1 returns an
                                          #     ActivitiDialogs hash with the activity entity IDs as
                                          #     keys and ActivityDialog Names as values
         UserID        => 123,            # mandatory
     );


Returns:


.. code-block:: perl

     $Activity = {
         ID             => 123,
         EntityID       => 'A1',
         Name           => 'some name',
         Config         => {
             Scope         => 'Global',
             ScopeEntityID => undef,
         },
         ActiviyDialogs => ['AD1','AD2','AD3'],
         CreateTime     => '2012-07-04 15:08:00',
         ChangeTime     => '2012-07-04 15:08:00',
     };
 
     $Activity = {
         ID           => 123,
         EntityID     => 'P1',
         Name         => 'some name',
         Config         => {
             Scope         => 'Process',
             ScopeEntityID => 'Process-9690ae9ae455d8614d570149b8ab1199',
         },
         ActivityDialogs => {
             'AD1' => 'ActivityDialog1',
             'AD2' => 'ActivityDialog2',
             'AD3' => 'ActivityDialog3',
         };
         CreateTime   => '2012-07-04 15:08:00',
         ChangeTime   => '2012-07-04 15:08:00',
     };



ActivityUpdate()
================


update Activity attributes

returns 1 if success or undef otherwise


.. code-block:: perl

     my $Success = $ActivityObject->ActivityUpdate(
         ID       => 123,                                                 # mandatory
         EntityID => 'A1',                                                # mandatory, exportable unique identifier
         Name     => 'NameOfProcess',                                     # mandatory
         Config   => {                                                    # mandatory, process configuration to be stored in YAML
             Scope         => 'Global',                                   # mandatory, default 'Global' (Process|Global)
             ScopeEntityID => 'Process-9690ae9ae455d8614d570149b8ab1199', # ScopeEntityID, used if specific scope is set e.g. 'Process'
         }
         UserID   => 123,                                                 # mandatory
     );



ActivityList()
==============


get an Activity list


.. code-block:: perl

     my $List = $ActivityObject->ActivityList(
         UseEntities => 0,                       # default 0, 1 || 0. if 0 the return hash keys are
                                                 #    the activity IDs otherwise keys are the
                                                 #    activity entity IDs
         UserID      => 1,
     );
 
     Returns:
 
     $List = {
         1 => 'Activity1',
     }
 
     or
 
     $List = {
         'A1' => 'Activity1',
     }



ActivityListGet()
=================


get an Activity list with all activity details


.. code-block:: perl

     my $List = $ActivityObject->ActivityListGet(
         UserID      => 1,
     );


Returns:


.. code-block:: perl

     $List = [
         {
             ID             => 123,
             EntityID       => 'A1',
             Name           => 'some name',
             Config         => $ConfigHashRef,
             ActiviyDialogs => ['AD1','AD2','AD3'],
             CreateTime     => '2012-07-04 15:08:00',
             ChangeTime     => '2012-07-04 15:08:00',
         }
         {
             ID             => 456,
             EntityID       => 'A2',
             Name           => 'some name',
             Config         => $ConfigHashRef,
             ActiviyDialogs => ['AD3','AD4','AD5'],
             CreateTime     => '2012-07-04 15:09:00',
             ChangeTime     => '2012-07-04 15:09:00',
         }
     ];



ActivitySearch()
================


search activities by process name


.. code-block:: perl

     my $ActivityEntityIDs = $ActivityObject->ActivitySearch(
         ActivityName => 'SomeText',       # e. g. "SomeText*", "Some*ext" or ['*SomeTest1*', '*SomeTest2*']
     );
 
     Returns:
 
     $ActivityEntityIDs = [ 'Activity-e11e2e9aa83344a235279d4f6babc6ec', 'Activity-f8194a25ab0ccddefeb4240c281c1f56' ];





