Search in sources :

Example 6 with ReplicationServiceException

use of org.alfresco.service.cmr.replication.ReplicationServiceException in project alfresco-repository by Alfresco.

the class ReplicationDefinitionPersisterImpl method renameReplicationDefinition.

public void renameReplicationDefinition(QName oldReplicationName, QName newReplicationName) {
    NodeRef actionNode = findActionNode(oldReplicationName);
    if (actionNode == null) {
        // So, nothing to do
        return;
    }
    // Ensure the destination name is free
    if (findActionNode(newReplicationName) != null) {
        throw new ReplicationServiceException("Can't rename to '" + newReplicationName + "' as a definition with that name already exists");
    }
    // Rename the node
    nodeService.moveNode(actionNode, REPLICATION_ACTION_ROOT_NODE_REF, ContentModel.ASSOC_CONTAINS, newReplicationName);
    // Update the definition properties
    ReplicationDefinition rd = loadReplicationDefinition(newReplicationName);
    rd.setParameterValue(ReplicationDefinitionImpl.REPLICATION_DEFINITION_NAME, newReplicationName);
    saveReplicationDefinition(rd);
// All done
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) ReplicationServiceException(org.alfresco.service.cmr.replication.ReplicationServiceException) ReplicationDefinition(org.alfresco.service.cmr.replication.ReplicationDefinition)

Aggregations

ReplicationDefinition (org.alfresco.service.cmr.replication.ReplicationDefinition)6 ReplicationServiceException (org.alfresco.service.cmr.replication.ReplicationServiceException)6 ScriptReplicationDefinition (org.alfresco.repo.replication.script.ScriptReplicationDefinition)4 UserTransaction (javax.transaction.UserTransaction)3 NodeRef (org.alfresco.service.cmr.repository.NodeRef)3 DisabledReplicationJobException (org.alfresco.service.cmr.replication.DisabledReplicationJobException)2 Date (java.util.Date)1 ActionCancelledException (org.alfresco.repo.action.ActionCancelledException)1 ActionImpl (org.alfresco.repo.action.ActionImpl)1 RuntimeActionService (org.alfresco.repo.action.RuntimeActionService)1 LockAcquisitionException (org.alfresco.repo.lock.LockAcquisitionException)1 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)1 ContentReader (org.alfresco.service.cmr.repository.ContentReader)1 TransferDefinition (org.alfresco.service.cmr.transfer.TransferDefinition)1 TransferEndEvent (org.alfresco.service.cmr.transfer.TransferEndEvent)1 TransferEventCancelled (org.alfresco.service.cmr.transfer.TransferEventCancelled)1 TransferEventError (org.alfresco.service.cmr.transfer.TransferEventError)1 TransferFailureException (org.alfresco.service.cmr.transfer.TransferFailureException)1