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
}
Aggregations