Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

108038: Merged 5.0.N (5.0.3) to HEAD-BUG-FIX (5.1/Cloud)
      107601: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.3)
         107332: Merged DEV to V4.2-BUG-FIX (4.2.5)
            105981 : MNT-12226 : Alfresco fails to version metadata after uploading new content version even when autoVersionOnUpdateProps=true
               - Added config for upload.post.js webscript. So now users may configure versioning for Share APP separatelly.
            106157 : MNT-12226 : Alfresco fails to version metadata after uploading new content version even when autoVersionOnUpdateProps=true
               - Updated previous solution so that if no config provided for upload.post.js webscript then default model versioning strategy used.,
         107537: MNT-12226 : Alfresco fails to version metadata after uploading new content version even when autoVersionOnUpdateProps=true
            - Fixed build failure.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@108069 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-07-09 22:09:30 +00:00
parent 7cb4909f5d
commit 65aa48b800
7 changed files with 52 additions and 1 deletions

View File

@@ -115,6 +115,9 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
/** flag indicating whether auto-versioning should be enabled or not */
private boolean enableAutoVersioning = true;
/** flag indicating whether auto-versioning should be enabled on properties update or not */
private boolean enableAutoVersionOnUpdateProps = false;
/**
* Set the policy component
*
@@ -204,6 +207,17 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
this.enableAutoVersioning = enableAutoVersioning;
}
/**
* Set whether the OnUpdatePropertiesPolicy should be binded or not. This is only used
* during {@link #init() initialization}.
*
* @param enableAutoVersionOnUpdateProps <tt>true</tt> to bind OnUpdatePropertiesPolicy sotherwise <tt>false</tt>
*/
public void setEnableAutoVersionOnUpdateProps(boolean enableAutoVersionOnUpdateProps)
{
this.enableAutoVersionOnUpdateProps = enableAutoVersionOnUpdateProps;
}
/**
* Initialise the versionable aspect policies
*/
@@ -453,7 +467,8 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
Map<QName, Serializable> before,
Map<QName, Serializable> after)
{
if ((this.nodeService.exists(nodeRef) == true) &&
if (this.enableAutoVersionOnUpdateProps && // MNT-12226 : additional setting to override the behavior for metadata versioning
(this.nodeService.exists(nodeRef) == true) &&
!LockUtils.isLockedAndReadOnly(nodeRef, lockService) &&
(this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) == true) &&
(this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY) == false))