Detailed Description

CopyController is used to copy or move Node instances.

The controller supports the following actions:

Action move
Move the given Node and its children to the given target Node (delete original Node).
Parameter Description
in oid The object id of the Node to move. The Node and all of its children will be moved
in targetOid The object id of the parent to attach the moved Node to (if it does not accept the Node type an error occurs) (optional, if empty the new Node has no parent)
out oid The object id of the newly created Node
Action copy
Copy the given Node and its children to the given target Node (keep original Node).
Parameter Description
in oid The object id of the Node to move. The Node and all of its children will be moved
in targetOid The object id of the parent to attach the moved Node to (if it does not accept the Node type an error occurs) (optional, if empty the new Node has no parent)
in nodesPerCall The number of Node instances to copy in one call (default: 50)
in recursive Boolean whether to copy children too (default: true)

For additional actions and parameters see BatchController actions.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 68 of file CopyController.php.

+ Inheritance diagram for CopyController:

Public Member Functions

 __construct (Session $session, PersistenceFacade $persistenceFacade, PermissionManager $permissionManager, ActionMapper $actionMapper, Localization $localization, Message $message, Configuration $configuration, EventManager $eventManager)
 
 __destruct ()
 
 initialize (Request $request, Response $response)
 
 afterCommit (TransactionEvent $event)
 
- Public Member Functions inherited from Controller
 __construct (Session $session, PersistenceFacade $persistenceFacade, PermissionManager $permissionManager, ActionMapper $actionMapper, Localization $localization, Message $message, Configuration $configuration)
 
 execute ($method=null)
 
 getRequest ()
 
 getResponse ()
 

Public Attributes

const OBJECT_MAP_VAR = 'objectmap'
 
const ACTION_VAR = 'action'
 
const ITERATOR_ID_VAR = 'CopyController.iteratorid'
 
const NODES_PER_CALL = 50
 
- Public Attributes inherited from BatchController
const REQUEST_VAR = 'request'
 
const ONE_CALL_VAR = 'oneCall'
 
const STEP_VAR = 'step'
 
const NUM_STEPS_VAR = 'numSteps'
 
const DOWNLOAD_STEP_VAR = 'downloadStep'
 
const PACKAGES_VAR = 'packages'
 
- Public Attributes inherited from Controller
const CSRF_TOKEN_PARAM = 'csrf_token'
 

Protected Member Functions

 validate ()
 
 getWorkPackage ($number)
 
 startProcess ($oids)
 
 copyNodes ($oids)
 
 endProcess (ObjectId $oid)
 
 copyNode (ObjectId $oid)
 
 getTargetNode (ObjectId $targetOID)
 
 registerCopy (PersistentObject $origNode, PersistentObject $copyNode)
 
 updateCopyOIDs (array $oidMap)
 
 getCopyOID (ObjectId $origOID)
 
 getCopy (ObjectId $origOID)
 
 modify (PersistentObject $node)
 
- Protected Member Functions inherited from BatchController
 doExecute ($method=null)
 
 getStepNumber ()
 
 addWorkPackage ($name, $size, array $oids, $callback, $args=null)
 
 processPart ($step)
 
 getRequestValue ($name)
 
 getNumberOfSteps ()
 
 getDisplayText ($step)
 
 getDownloadFile ()
 
 cleanup ()
 
- Protected Member Functions inherited from Controller
 executeSubAction ($action)
 
 redirect ($location, $key=null, $data=null)
 
 getLogger ()
 
 getSession ()
 
 getPersistenceFacade ()
 
 getPermissionManager ()
 
 getActionMapper ()
 
 getLocalization ()
 
 getMessage ()
 
 getConfiguration ()
 
 requireTransaction ()
 
 endTransaction ($commit)
 
 isLocalizedRequest ()
 
 checkLanguageParameter ()
 
 generateCsrfToken ($name, $refresh=true)
 
 validateCsrfToken ($name, $invalidate=true)
 
 getLocalSessionValue ($key, $default=null)
 
 setLocalSessionValue ($key, $value)
 
 clearLocalSessionValues ()
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( Session  $session,
PersistenceFacade  $persistenceFacade,
PermissionManager  $permissionManager,
ActionMapper  $actionMapper,
Localization  $localization,
Message  $message,
Configuration  $configuration,
EventManager  $eventManager 
)

Constructor.

Parameters
$session
$persistenceFacade
$permissionManager
$actionMapper
$localization
$message
$configuration
$eventManager

Definition at line 94 of file CopyController.php.

◆ __destruct()

__destruct ( )

Destructor.

Definition at line 112 of file CopyController.php.

Member Function Documentation

◆ initialize()

initialize ( Request  $request,
Response  $response 
)
See also
Controller::initialize()

Reimplemented from BatchController.

Definition at line 119 of file CopyController.php.

◆ validate()

validate ( )
protected
See also
Controller::validate()

Reimplemented from Controller.

Definition at line 146 of file CopyController.php.

◆ getWorkPackage()

getWorkPackage (   $number)
protected
See also
BatchController::getWorkPackage()

Reimplemented from BatchController.

Definition at line 202 of file CopyController.php.

◆ startProcess()

startProcess (   $oids)
protected

Copy/Move the first node (object ids parameter will be ignored)

Parameters
$oidsThe object ids to process

Definition at line 226 of file CopyController.php.

◆ copyNodes()

copyNodes (   $oids)
protected

Copy nodes provided by the persisted iterator (object ids parameter will be ignored)

Parameters
$oidsThe object ids to process

Definition at line 299 of file CopyController.php.

◆ endProcess()

endProcess ( ObjectId  $oid)
protected

Finish the process and set the result.

Parameters
$oidThe object id of the newly created Node

Definition at line 344 of file CopyController.php.

◆ copyNode()

copyNode ( ObjectId  $oid)
protected

Create a copy of the node with the given object id.

The returned node is already persisted.

Parameters
$oidThe object id of the node to copy
Returns
The copied Node or null

Definition at line 355 of file CopyController.php.

◆ afterCommit()

afterCommit ( TransactionEvent  $event)

Update oids after commit.

Parameters
$event

Definition at line 415 of file CopyController.php.

◆ getTargetNode()

getTargetNode ( ObjectId  $targetOID)
protected

Get the target node from the request parameter targetoid.

Parameters
$targetOIDThe object id of the target node
Returns
Node instance

Definition at line 427 of file CopyController.php.

◆ registerCopy()

registerCopy ( PersistentObject  $origNode,
PersistentObject  $copyNode 
)
protected

Register a copied node in the session for later reference.

Parameters
$origNodeThe original Node instance
$copyNodeThe copied Node instance

Definition at line 442 of file CopyController.php.

◆ updateCopyOIDs()

updateCopyOIDs ( array  $oidMap)
protected

Update the copied object ids in the registry.

Parameters
$oidMapMap of changed object ids (key: old value, value: new value)

Definition at line 453 of file CopyController.php.

◆ getCopyOID()

getCopyOID ( ObjectId  $origOID)
protected

Get the object id of the copied node for a node id.

Parameters
$origOIDThe object id of the original node
Returns
ObjectId or null, if it does not exist already

Definition at line 475 of file CopyController.php.

◆ getCopy()

getCopy ( ObjectId  $origOID)
protected

Get the copied node for a node id.

Parameters
$origOIDThe object id of the original node
Returns
Copied Node or null, if it does not exist already

Definition at line 497 of file CopyController.php.

◆ modify()

modify ( PersistentObject  $node)
protected

Modify the given Node before save action (Called only for the copied root Node, not for its children)

Note
Subclasses will override this to implement special application requirements.
Parameters
$nodeThe Node instance to modify.

Definition at line 514 of file CopyController.php.

Member Data Documentation

◆ OBJECT_MAP_VAR

const OBJECT_MAP_VAR = 'objectmap'

Definition at line 71 of file CopyController.php.

◆ ACTION_VAR

const ACTION_VAR = 'action'

Definition at line 72 of file CopyController.php.

◆ ITERATOR_ID_VAR

const ITERATOR_ID_VAR = 'CopyController.iteratorid'

Definition at line 75 of file CopyController.php.

◆ NODES_PER_CALL

const NODES_PER_CALL = 50

Definition at line 81 of file CopyController.php.