Merged 5.1-MNT1 (5.1.0) to HEAD (5.1)

115567 adavis: Merged 5.1.N (5.1.1) to 5.1-MNT1 (5.1.0)
      112920 adavis: 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/HEAD/root@115697 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-10-30 00:17:51 +00:00
parent aee9e920ed
commit 349ad866a5
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)
{