
#####
Clone
#####


****
NAME
****


Kernel::System::ProcessManagement::DB::Clone - clone processes and process elements


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


Full process clone creates an independent inactive copy. Every contained activity, activity
dialog, transition and transition action receives a new EntityID. References inside the process,
including path, layout, start activity and process scope, point at the cloned entities.

Copy of a process only duplicates the process container and keeps the original element EntityIDs.
Clone does not do that.

Dynamic fields referenced by dialogs or transition actions are reused, not duplicated.
Process icons and other file preferences are stored again under the new process EntityID.
ACLs, ticket history and statistics are not copied.
Dialog order and the process path are preserved.

Partial clone duplicates one element. Cloning an activity also clones its activity dialogs.
Those dialogs assume the scope of the activity being cloned.
The original element stays unchanged. Nothing is written until a name is supplied.


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


new()
=====


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


.. code-block:: perl

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



ProcessClone()
==============


Create an independent inactive copy of a process.


.. code-block:: perl

     my $Result = $CloneObject->ProcessClone(
         ID     => 123,                              # ID or EntityID required
         EntityID => 'Process-9690ae9ae455d8614d570149b8ab1199',
         Name   => 'Incident Management (Clone)',    # required, chosen by the user
         UserID => 1,
     );


Returns:


.. code-block:: perl

     $Result = {
         Success   => 1,
         ProcessID => 456,
         EntityID  => 'Process-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
     };


Nothing is created when Name is missing or the clone fails. A failed clone is rolled back.


EntityClone()
=============


Clone one process element. Activity clone also clones the activity dialogs of that activity.
The caller must pass the name. No data is written when the name is missing.


.. code-block:: perl

     my $Result = $CloneObject->EntityClone(
         EntityType => 'Activity',          # Activity, ActivityDialog, Transition, TransitionAction
         EntityID   => 'Activity-9690ae9ae455d8614d570149b8ab1199',
         Name       => 'Approval (Clone)',
         UserID     => 1,
     );




