Copy Folder Trigger

Overview

The Copy Folder Trigger copies the parent folder of an asset in workflow to a location designated by a parameter passed to the trigger. It also realigns structured data asset choosers for assets contained in the folder being copied so that the user does not have to realign the asset choosers manually.

Example: There exists a page 'p1' in folder 'a' that has a page chooser that points to a page 'p2' residing in folder 'a/b' (a child folder of 'a'). If folder 'a' is put into workflow and the Copy Folder Trigger is invoked, the page chooser in the copied 'p1' page will point to the page 'p2' in the new 'a/b' folder, rather than the page 'p2' contained in the original 'a/b' folder.

Declaration


            <trigger class="com.cms.workflow.function.CopyFolder" name="CopyFolder"/>
            

Usage


            <trigger name="CopyFolder">  
   <parameter>  
      <name>destPath</name>  
      <value>/CopyFolder/locale2</value>  
   </parameter>  
</trigger>
            

Parameters

destPath

            <parameter>  
   <name>destPath</name>  
   <value>/CopyFolder/locale2</value>  
</parameter>
            

The destPath parameter is used to determine where the parent folder should publish to. If more than one location is required, these can be delimited by commas (",") within the same parameter.

basePath

            <parameter>  
   <name>basePath</name>  
   <value>/CopyFolder/original</value>  
</parameter>
            

The basePath parameter is used when the folder to be copied should be copied into a sub-folder of the folder designated by the destPath parameter. By default, this parameter is given the value of the path of the parent folder of the folder being copied. This default ensures that any folders copied with the trigger will be created as a direct descendant of the destination folder.

Setting this parameter to a value that is higher in the folder hierarchy than the parent of the folder being copied makes it possible to use the Copy Folder Trigger to copy folders at any level deep below the folder corresponding to basePath to an analogous folder found in the destination folder.

For example, say there exists a folder '/base' (a direct child of the system base folder) which contains a folder 'a' which contains a folder 'b'; and the destPath has been specified as '/dest' (also a direct child of the system base folder).  Assume the basePath has been set to '/base'. Starting a workflow that uses the Copy Folder Trigger on an asset inside folder 'b' would cause the folder 'b' to be copied into the folder with path '/dest/a' (resulting in a folder with path '/dest/a/b'), because folder 'a' was below the folder designated as the basePath folder. Note that folder '/dest/a' has to exist before folder 'b' can be copied into it. The trigger will not automatically create a sub-tree of folders. The idea is that one would first use the Copy Folder Trigger to copy folder 'a' to all destPaths, and then folder 'b' would be created so that it could be copied after 'a' had been copied. If the goal is simply to copy an entire folder tree to another location, then this would not be necessary; a single folder copy would do the job. If, however, the goal is to incrementally copy folders and subfolders inside a particular 'base' folder to another specified location, you would use this parameter.

includeAssetInWorkflow

            <parameter>  
   <name>includeAssetInWorkflow</name>  
   <value>true</value>  
</parameter>
            

This parameter indicates whether or not the asset originally put into workflow will be copied to the new location. It defaults to false.

It does not make sense to set this parameter to true if the asset is in a create workflow and has not been merged (using the Merge workflow trigger), because the asset is still a working copy and cannot be copied to a new location.

Required Intermediate Step

The Copy Folder Trigger requires an intermediate transition step assigned to a default user that cannot be touched by any regular users. This intermediate step prevents users from clicking through the workflow before the Copy Folder Trigger has finished its copy. The intermediate step requires one action that moves to the next desired step after the copy is complete.

Example:


            <step default-user="admin" identifier="copying" type="transition">  
    <actions>  
        <action identifier="proceed" move="forward" type="auto"/>  
    </actions>  
</step>