Merged 5.1.N (5.1.1) to HEAD (5.1)

120109 nsmintanca: Merged 5.0.N (5.0.4) to 5.1.N (5.1.1)
      120046 abozianu: Merged DEV to 5.0.N (5.0.4)
         117528 abozianu: MNT-14687 : Creating a document as checkedout and then cancelling the checkout should delete the document
            - added a new aspect for cmis checked out documents : ASPECT_CMIS_CHECKEDOUT
         118441 abozianu: MNT-14687 : Creating a document as checkedout and then cancelling the checkout should delete the document
            - changed aspect name from ASPECT_CMIS_CHECKEDOUT to ASPECT_CMIS_CREATED_CHECKEDOUT
         118775 abozianu: MNT-14687 : Creating a document as checkedout and then cancelling the checkout should delete the document
            - fixed commit error


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@123614 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-03-11 21:35:01 +00:00
parent 096c5871d8
commit 0f53f8c413
5 changed files with 79 additions and 6 deletions

View File

@@ -1447,9 +1447,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
nodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, null);
}
Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(5);
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
versionProperties.put(VersionModel.PROP_DESCRIPTION, "Initial Version");
// MNT-14687 : Creating a document as checkedout and then cancelling the checkout should delete the document
nodeService.addAspect(nodeRef, ContentModel.ASPECT_CMIS_CREATED_CHECKEDOUT, null);
getCheckOutCheckInService().checkout(nodeRef);
}

View File

@@ -488,6 +488,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService,Extens
nodeService.addAspect(workingCopy, ContentModel.ASPECT_LOCKABLE, null);
nodeService.addAspect(nodeRef, ContentModel.ASPECT_CHECKED_OUT, null);
nodeService.createAssociation(nodeRef, workingCopy, ContentModel.ASSOC_WORKING_COPY_LINK);
nodeService.removeAspect(workingCopy, ContentModel.ASPECT_CMIS_CREATED_CHECKEDOUT);
}
finally
{
@@ -648,13 +649,17 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService,Extens
}
}
}
if (versionProperties != null && nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE))
if (versionProperties != null &&
nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) &&
!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_CMIS_CREATED_CHECKEDOUT))
{
// Create the new version
this.versionService.createVersion(nodeRef, versionProperties);
}
nodeService.removeAspect(nodeRef, ContentModel.ASPECT_CMIS_CREATED_CHECKEDOUT);
if (keepCheckedOut == false)
{
// Delete the working copy
@@ -728,6 +733,11 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService,Extens
// Invoke policy
invokeOnCancelCheckOut(nodeRef);
if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_CMIS_CREATED_CHECKEDOUT))
{
nodeService.deleteNode(nodeRef);
}
}
catch (UnableToReleaseLockException exception)
{
@@ -740,7 +750,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService,Extens
return nodeRef;
}
@Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef getWorkingCopy(NodeRef nodeRef)

View File

@@ -140,6 +140,11 @@ public class WorkingCopyAspect implements CopyServicePolicies.OnCopyNodePolicy,
{
lockService.unlock(checkedOutNodeRef, false, true);
nodeService.removeAspect(checkedOutNodeRef, ContentModel.ASPECT_CHECKED_OUT);
if (nodeService.hasAspect(checkedOutNodeRef, ContentModel.ASPECT_CMIS_CREATED_CHECKEDOUT))
{
nodeService.deleteNode(checkedOutNodeRef);
}
}
finally
{