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 BatchController
 initialize (Request $request, Response $response)
 
- Public Member Functions inherited from Controller
 __construct (Session $session, PersistenceFacade $persistenceFacade, PermissionManager $permissionManager, ActionMapper $actionMapper, Localization $localization, Message $message, Configuration $configuration)
 
 initialize (Request $request, Response $response)
 
 execute ($method=null)
 
 getRequest ()
 
 getResponse ()
 

Public Attributes

const OBJECT_MAP_VAR = 'objectmap'
 
const ACTION_VAR = 'action'
 
const ITERATOR_ID_VAR = 'CopyController.iteratorid'
 
- 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, $oids, $callback, $args=null)
 
 processPart ($step)
 
 getRequestValue ($name)
 
 getNumberOfSteps ()
 
 getDisplayText ($step)
 
 getDownloadFile ()
 
 getWorkPackage ($number)
 
 cleanup ()
 
- Protected Member Functions inherited from Controller
 validate ()
 
 doExecute ($method=null)
 
 executeSubAction ($action)
 
 redirect ($location, $key=null, $data=null)
 
 getLogger ()
 
 getSession ()
 
 getPersistenceFacade ()
 
 getPermissionManager ()
 
 getActionMapper ()
 
 getLocalization ()
 
 getMessage ()
 
 getConfiguration ()
 
 requireTransaction ()
 
 endTransaction ($commit)
 
 isLocalizedRequest ()
 
 checkLanguageParameter ()
 
 generateCsrfToken ($name)
 
 validateCsrfToken ($name)
 
 getLocalSessionValue ($key, $default=null)
 
 setLocalSessionValue ($key, $value)
 
 clearLocalSessionValues ()
 

Constructor & Destructor Documentation

__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 ( )

Destructor.

Definition at line 112 of file CopyController.php.

Member Function Documentation

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

Definition at line 119 of file CopyController.php.

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

Definition at line 146 of file CopyController.php.

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

Definition at line 202 of file CopyController.php.

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 (   $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 ( 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 ( 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 ( TransactionEvent  $event)

Update oids after commit.

Parameters
$event

Definition at line 415 of file CopyController.php.

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

const OBJECT_MAP_VAR = 'objectmap'

Definition at line 71 of file CopyController.php.

const ACTION_VAR = 'action'

Definition at line 72 of file CopyController.php.

const ITERATOR_ID_VAR = 'CopyController.iteratorid'

Definition at line 75 of file CopyController.php.