Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)

112568 abozianu: MNT-14687 : Creating a document as checkedout and then canceling the checkout should delete the document


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@112920 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-09-23 20:35:38 +00:00
parent 9f209f804b
commit bf40bd0c26
2 changed files with 79 additions and 0 deletions

View File

@@ -707,6 +707,10 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
// Invoke policy
invokeOnCancelCheckOut(nodeRef);
// If the node does not have an initial version checked out delete it
removeNodeIfInCheckedOutState(nodeRef);
}
catch (UnableToReleaseLockException exception)
{
@@ -720,6 +724,25 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
return nodeRef;
}
/**
* If the node does not have an initial version checked out delete it.
* MNT-14687 - Creating a document as checkedout and then cancelling the
* checkout should delete the document.
*/
private void removeNodeIfInCheckedOutState(NodeRef nodeRef)
{
if (!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE))
{
return;
}
Boolean initialVersion = (Boolean) nodeService.getProperty(nodeRef, ContentModel.PROP_INITIAL_VERSION);
if (initialVersion != null && initialVersion == false)
{
nodeService.deleteNode(nodeRef);
}
}
@Override
public NodeRef getWorkingCopy(NodeRef nodeRef)
{